Note that in the Draft WB "draft", not "Command", is used as the context for these strings. And that seems to work fine.
Extension tools: Use of sMenuText and setText? Translation context?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Extension tools: Use of sMenuText and setText? Translation context?
Sorry, I misunderstood when reading. Indeed QObject::tr() should not be used "as is".Roy_043 wrote: ↑Wed Jan 26, 2022 2:02 pmSee: https://github.com/FreeCAD/FreeCAD/blob ... w.ts#L1175
You should always call a simple "tr()" without preceding it with class name.
There is roughly 2 main cases :
* Your class inherits QObject. In this case, you add the "Q_OBJECT" macro in class prototype, and "tr()" is subclassed automatically doing so.
* Your class doesn't inherits QObject. In this case, you "activate" the translation by addin the "Q_DECLARE_TR_FUNCTIONS(ClassName)" in the class prototype, that will deal with declaring "tr()" appropriately.
Complete reading : https://doc.qt.io/qt-5/i18n-source-translation.html