FinderCheng
16th October 2009, 02:00
Hi, there! I have a problem about i18n.
I have added
TRANSLATIONS += resources/locale/pw_zh_CN.ts
into .pro file and use lupdate and linguist tools to get .qm file. Then I use the following code to install translators on my application:
QTranslator appTranslator;
qDebug() << appTranslator.load("../resources/locale/pw_zh_CN");
qApp.installTranslator(&appTranslator);
OK, the qDebug() output true which means Qt has successfully load .qm file. But when I tried to run my application, there were still original english words that defined in tr() on UI. I don't know why.
I have tried to create a new project and do this as I said. It can translate this test window. I'm using QtCreator IDE.
I really don't know why this happen, could you tell me how to solve this problem?
Thank you!
=========================
PS: I have fixed this problem. It is because I use
using namespace XXX;
instead of
XXX::AppCass::foo()
in *.cpp files. But I still have a problem: only in one dialog it cannot translate, others are OK...
I have added
TRANSLATIONS += resources/locale/pw_zh_CN.ts
into .pro file and use lupdate and linguist tools to get .qm file. Then I use the following code to install translators on my application:
QTranslator appTranslator;
qDebug() << appTranslator.load("../resources/locale/pw_zh_CN");
qApp.installTranslator(&appTranslator);
OK, the qDebug() output true which means Qt has successfully load .qm file. But when I tried to run my application, there were still original english words that defined in tr() on UI. I don't know why.
I have tried to create a new project and do this as I said. It can translate this test window. I'm using QtCreator IDE.
I really don't know why this happen, could you tell me how to solve this problem?
Thank you!
=========================
PS: I have fixed this problem. It is because I use
using namespace XXX;
instead of
XXX::AppCass::foo()
in *.cpp files. But I still have a problem: only in one dialog it cannot translate, others are OK...