[Qt-interest] Localization of plugins

Anatoly Burakov burakov.anatoly at googlemail.com
Mon Nov 2 12:56:24 CET 2009


R. Reucher wrote:
> On Mon, 02 Nov 2009 11:43:40 +0000, Anatoly Burakov wrote:
>   
>> I have a program that has multilingual interface. It loads *.qm files
>> perfectly. However, i can't seem to find a way for a plugin loaded by a
>> program to load its own *.qm file. Is there any way to do that at all?
>>     
> I don't think there's a restriction of that sort in the plugin mechanism, 
> however, when you load the plugin, you can also load the corresponding 
> *.qm file _additionally_ -- using an additional QTranslator!
>
>   QString lang = "de";
>   ...
>   myAppTranslator = new QTranslator(0);
>   myAppTranslator->load("data/lang/myapp_") + lang + ".qm");
>   qApp->installTranslator(myAppTranslator);
>   ...
>   myPluginTranslator = new QTranslator(0);
>   myPluginTranslator->load("data/lang/plugin_") + lang + ".qm");
>   qApp->installTranslator(myPluginTranslator);
>   ...
>
> HTH, René
>   
I remember reading QT documentation and it said that whenever i install 
a translator it removes any previous translators... However, i'll check 
it out once again, thanks!



More information about the Qt-interest-old mailing list