When to use translate.py?

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

When to use translate.py?

Post by Roy_043 »

In the same file several functions can be used to translate texts. What should be used where?

Two examples from gui_groups.py:

Code: Select all

QT_TRANSLATE_NOOP("Draft_AddToGroup","Ungroup")
https://github.com/FreeCAD/FreeCAD/blob ... ups.py#L66

Code: Select all

_tr("+ Add new group")
https://github.com/FreeCAD/FreeCAD/blob ... ups.py#L68

The last function, _tr, always uses "Draft" as the context. So for texts in the same file two different contexts are used here.
Post Reply