[Qt-jambi-interest] More QTranslator instances - how it works?
Dusan Zatkovsky
msk.conf at gmail.com
Tue Dec 15 12:59:14 CET 2009
Hi.
I have (still) a problems with translator.
When you take a look into doc for QCoreApplication::translate in assistant,
there is following text:
"Returns the translation text for sourceText, by querying the installed
translation files. The translation files are searched from the most recently
installed file back to the first installed file."
And:
"QCoreApplication::installTranslator ( QTranslator * translationFile ) Adds
the translation file translationFile to the list of translation files to be
used for translations. Multiple translation files can be installed.
Translations are searched for in the last installed translation file on, back
to the first installed translation file. The search stops as soon as a
matching translation is found."
I need to know how the mechanism of "more translators" works.
Look at the following code ( MyTranslator is my class subclassed from
QTranslator ):
// this should translate "right" to "xyz"
MyTranslator t1 = new MyTranslator ( "file1.ts" );
// this should translate "foo" to "faa"
MyTranslator t2 = new MyTranslator ( "file1.ts" );
// I am installing two instances, 'cause documentation say to do so
QApplication.installTranslator(t1);
QApplication.installTranslator(t2);
QApplication.translate ( "Context", "foo" );
... now t1 is called to translate "foo". But t1 it doesn't know how to
translate it, it knows only "right->xyz" translation. So it returns "foo"
back.
... t2 is never called then
So my question is - how translating process works?
--
Dusan
More information about the Qt-jambi-interest
mailing list