Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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.

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.

Re: OMEdit localization problems

thx. ok, i will try.

Re: OMEdit localization problems

thx. ok, i will try.

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.

There are 0 guests and 0 other users also viewing this topic
You are here: