to_guliang
9th March 2010, 02:35
hi to all!
I'd like to do dynamic language switching in my application,but there is a problem.
there are three language in my project:english, Chinese simplified and Chinese Traditional. I chagne the language by the menu.
connect(actE,SIGNAL(triggered()),this,SLOT(LanEnli sh()));
if(languageType == 0)
{
return;
}
translator.load("language_Eng");
qApp->installTranslator(&translator);
retranslateUi(this);
//call the retranslateUi() in the ComSetup and Navigation, the ComSetup and Navigation are dialogs designered by the QT designer
ComSetup->SwitchLanguage();
Navigation->SwitchLanguage();
languageType = 0;
Now the problem is like this: the language are designed in the QT designer in the dialog could be translated exactly. the language that added to the dialog in the program(.cpp)can't be translated. for example, there is "dockWidget = new QDockWidget(tr("Navigation"),this);" in the .cpp,the "Navigation" can't be translated. i make sure the according word has been translateed in the "language_Eng".
Do you know what I mean? Have you got any ideas what's wrong with it ?
Regards to all.
I'd like to do dynamic language switching in my application,but there is a problem.
there are three language in my project:english, Chinese simplified and Chinese Traditional. I chagne the language by the menu.
connect(actE,SIGNAL(triggered()),this,SLOT(LanEnli sh()));
if(languageType == 0)
{
return;
}
translator.load("language_Eng");
qApp->installTranslator(&translator);
retranslateUi(this);
//call the retranslateUi() in the ComSetup and Navigation, the ComSetup and Navigation are dialogs designered by the QT designer
ComSetup->SwitchLanguage();
Navigation->SwitchLanguage();
languageType = 0;
Now the problem is like this: the language are designed in the QT designer in the dialog could be translated exactly. the language that added to the dialog in the program(.cpp)can't be translated. for example, there is "dockWidget = new QDockWidget(tr("Navigation"),this);" in the .cpp,the "Navigation" can't be translated. i make sure the according word has been translateed in the "language_Eng".
Do you know what I mean? Have you got any ideas what's wrong with it ?
Regards to all.