wmayer wrote: ↑Tue Sep 28, 2021 12:56 pm
Evgeniy wrote: ↑Sat Sep 25, 2021 7:01 pm
We just need to agree (create a rule and follow it) on which key context name we will use with sGroup values of commands and insert this context in all Command.cpp an Commands.py files in all places where is sGroup value exists.
It's all correct what you write but there is one little issue: it won't work. At least not the way how it is now.
The method getGroupName() returns the member variable sGroup of a command and this method is used in several dialogs like this:
Code: Select all
QString text = qApp->translate(cmd->className(), cmd->getGroupName());
This means the context string is the Command class name itself and when you change the context string inside the class to "Workbench" then qApp->translate() will fail to find the translation. At the moment it works because the .ts files still contain the different contexts of the group name. But as soon as the .ts file are cleaned-up it will stop working.
I have read your proposal several times and I think I understand what you mean.
Could you show links to using these strings:
Code: Select all
QString text = qApp->translate(cmd->className(), cmd->getGroupName());
in source code? I not find examples...
I tried to find examples by searching on github, but I didn't find them... Sorry but I don't know source code fully.
getGroupName() is used but not with combination of cmd->className().
I think your proposal will require, a change getGroupName method:
from
https://github.com/FreeCAD/FreeCAD/blob ... and.h#L569
Code: Select all
const char* getGroupName() const { return sGroup; }
to something like this:
Code: Select all
const char* getGroupName() const{
return QT_TRANSLATE_NOOP("Workbench",sGroup);
}
This needs to weigh everything well...
Are you sure this will work correctly? You ready to update this method (or maybe other methods too)?
What other developers thing about this proposal?