FreeCAD coding/documentation standards?

Discussions about the wiki documentation of FreeCAD and its translation.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: FreeCAD coding/documentation standards?

Post by Kunda1 »

NormandC wrote: Thu Mar 22, 2018 2:59 am I'm so tired of it not getting done that I would change the source code and submit a PR myself, if someone showed me how. I'm no programmer but I have an analytic mind.
If you change the source code, I'll submit the PR :D
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FreeCAD coding/documentation standards?

Post by NormandC »

Submitting the PR I could figure out, I can find instructions previously posted. It's the changing code I have no clue how.
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: FreeCAD coding/documentation standards?

Post by yorik »

There is not one unified way to do this unfortunately, it depends on each module. I think the right way would be to leave the object Name in english, so someone can for example open a file made in another language and still figure out more or less what the object is (although the icon informs), and just translate the Label.

In python module, that means basically that in every place where a new object is created, for ex. with a line like this:

Code: Select all

obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Line")
it should be followed by a line like this:

Code: Select all

obj.Label = translate("Draft","Line")
That's the theory. In practice each module will have implemented this in different ways...

But you are right. I'll take care of this for Draft and Arch after the 0.18 release. issue #3388
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FreeCAD coding/documentation standards?

Post by NormandC »

yorik wrote: Thu Mar 22, 2018 1:26 pm I think the right way would be to leave the object Name in english, so someone can for example open a file made in another language and still figure out more or less what the object is (although the icon informs), and just translate the Label.
Sorry but I'm a little confused. One one side you want to leave the object's "name" in English, but on the other side you want to translate the label? In the Model tree, isn't it the label rather than the name which is shown?

I guess you mean the internal name which shows in preselection in the status bar, or in some GUI dialogues and of course in the python console. I hadn't thought of that.

I understand it would create major headaches to translate the internal name. I think just allowing label translation would be fine. Of course, that might be problematic with GUI dialogues that show the internal names instead of the label. But the problem exists already when the user renames the labels.
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: FreeCAD coding/documentation standards?

Post by yorik »

NormandC wrote: Fri Mar 23, 2018 3:36 am I guess you mean the internal name which shows in preselection in the status bar
Yes exactly. This internal name at the moment also doesn't support non-ASCII characters, which I think is a good thing, because then we are 100% sure there will never be unicode problem with them.

So yes, only the Label (ie. the name that appears in the tree, and that the user can change) would be translated.
Post Reply