- Index
- » Developer
- » OpenModelica development
- » OMEdit localization problems
OMEdit localization problems
OMEdit localization problems
Hello OM developers,
Static variables couldn't be translated with Qt (http://stackoverflow.com/questions/3493 … variable).
I translate OMEdit UI and faced with this problem in Helper.cpp (and in some other classes).
Is it critical to use statick variables for text in UI controls and error msg? (Static function 'GUIMessages' is used 140 times.)
Re: OMEdit localization problems
No, it's not required. However, it is a reasonable coding style. And we can keep them and still support the translation according to that stackoverflow article.
The change is rather simple:
Create a static function initGlobalTranslationStrings(), called in main (after installing the Qt translator to the system, but before creating any GUI windows). This function should set up all the strings.
Code:
void initGlobalTranslationStrings(void) {
readOnly = tr("Read-Only");
writeAble = tr("Writeable");
iconView = tr("Icon View");
diagramView = tr("Diagram View");
modelicaTextView = tr("Modelica Text View");
documentationView = tr("View Documentation");
}
Or something like that.
- sjoelund.se
- 1700 Posts
Re: OMEdit localization problems
You can also take a look at QT_TR_NOOP() http://qt-project.org/doc/qt-4.8/qtglob … QT_TR_NOOP
But I guess what Sjoelund recommended is rather easy to implement.
Adeel.
- adeas
- 454 Posts
Re: OMEdit localization problems
Hi,
I have updated the source code. Now you can define translations for static variables as well.
Can you update your Russian translations file? Thanks.
Adeel.
- adeas
- 454 Posts
- Index
- » Developer
- » OpenModelica development
- » OMEdit localization problems