I create a translation,and want to translate English into chinese.
but I find that that only the manwindow does,the other class (such as opendialog) all do not?
why?
I create a translation,and want to translate English into chinese.
but I find that that only the manwindow does,the other class (such as opendialog) all do not?
why?
Did you install a translator for strings from Qt library apart the translator for your own application strings?
thk u for your answer.
I think I have done.
Qt Code:
QTranslator qtTranslator qtTranslator.laod("pseim_translation/qt_zh_CN.qm"); a.installTranslator(&qtTranslator);To copy to clipboard, switch view to plain text mode
In the other class(such as class inherited from QDialog),I have created my own string,and add 'tr' for them,but it is not traslated.
Where did you put the above code? Are you sure the translator doesn't go out of scope? Where did you put the other translator, can we see code for it as well?
I put them in the main function.
Strings in the Ogre3dFrame have been translated,Must I load traslator in the other class?how to realize it,for there only is "QApplication a(argc, argv);" in the main function ,and not in the other class.Qt Code:
int main(int argc, char *argv[]) { QTranslator newTranslator; newTranslator.load( "pseism_translation/satellite3d_zh.qm"); a.installTranslator( &newTranslator ); QTranslator qtTranslator; qtTranslator.load( "pseism_translation/qt_zh_CN.qm"); a.installTranslator( &qtTranslator ); frame->show(); return a.exec(); }To copy to clipboard, switch view to plain text mode
Strings in the Ogre3dFrame have been translated,in other class not.
Yes,I translate them in the Linguist.
linguist..PNG
Strings in the class circled by ellipse have been translated in the Linguist,and Strings in the Ogre3dFrame have been translated in the Linguist.when I run my program,the former not translated,the latter done.
Do you have Q_OBJECT macro in classes where you get no translations?
Yes,I have.
Bookmarks