PDA

View Full Version : translation



weixj2003ld
26th May 2010, 09:22
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?

wysota
26th May 2010, 09:47
Did you install a translator for strings from Qt library apart the translator for your own application strings?

weixj2003ld
27th May 2010, 00:58
thk u for your answer.
I think I have done.


QTranslator qtTranslator
qtTranslator.laod("pseim_translation/qt_zh_CN.qm");
a.installTranslator(&qtTranslator);


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.

wysota
27th May 2010, 07:22
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?

weixj2003ld
27th May 2010, 09:07
I put them in the main function.



int main(int argc, char *argv[])
{
QApplication a(argc, 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 );

Ogre3dFrame *frame=new Ogre3dFrame(QString(argv[1]),QString(argv[2]));
frame->show();

return a.exec();
}

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.

wysota
27th May 2010, 12:40
So what is translated and what is not? Did you translate all the texts in Linguist?

weixj2003ld
28th May 2010, 01:44
Strings in the Ogre3dFrame have been translated,in other class not.
Yes,I translate them in the Linguist.

4693

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.

bender86
28th May 2010, 13:44
Do you have Q_OBJECT macro in classes where you get no translations?

weixj2003ld
31st May 2010, 01:01
Yes,I have.