[Qt-creator] how to make translations for plugins made for qt creator

Ziller Eike Eike.Ziller at theqtcompany.com
Fri May 8 11:35:06 CEST 2015


> On May 8, 2015, at 05:18, 王丹华 <kongsuxinghen_m at 163.com> wrote:
> 
> Hi:all
> 	I am just want to make a plugin which supporting muti-languages for qt creator,but I can not find how to do .Is there a method to do this?Or to modify the translations in source directly, I don’t want to modify the source,so what can I do .
> 	I will be greatly appreciated for your help.

In your plugin’s initialize method (or constructor might also work, if you already create some UI there), you need to take ICore::userInterfaceLanguage(), create a QTranslator, load the transation file corresponding to the language with it, and install it in the application.
For an example see the  HelpPlugin::initialize method
(http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/plugins/help/helpplugin.cpp#n124)

Note that we currently do not have a nice way for “external” plugins to install additional resource files, so your best option is probably to include your .qm files through QRC

Br, Eike

-- 
Eike Ziller, Senior Software Engineer | The Qt Company
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list