Hi,

I want to have all the translated strings in one place in my source code, so I've created a Strings class that extends QObject that consists of static QString objects.

The header file contains declarations like:

Qt Code:
  1. const static QString PENDING;
To copy to clipboard, switch view to plain text mode 

and then a .cpp file contains

Qt Code:
  1. const QString Strings::PENDING(tr("Pending"));
To copy to clipboard, switch view to plain text mode 

I can run lupdate on the .cpp file, open the resulting .ts file in linguist and see that I need to translate "Pending". I do that, save everything, and run lrelease.

Then in the main method of my app, before creating widgets I run:

Qt Code:
  1. QString file ("/usr/local/swdevel/share/dbaker/lib/instr_fr");
  2. bool loaded = translator->load(file);
  3. TRACE("Loaded: %s\n", loaded ? "true" : "false");
  4. app.installTranslator(translator);
To copy to clipboard, switch view to plain text mode 

but when I try to display or just print out the value of the variable, I only get the English.

Is there some problem with using tr in static members of a class?

Thanks in advance.

Derek