Qt 5.5 tr usage

in .cpp file, wherever you want, wrap QString with a tr("somesz") rendering it ready to be translated.

in .pro file, specify the readable translation file:

1 //*.pro
2 TRANSLATIONS += *tr_chn.ts
3 TRANSLATIONS += *tr_la.ts
4 ...

in the project location, call the lupdate.exe in the the desired version folder's bin:

1 lupdate *.pro

generated *tr_*.ts file, open them as .txt file, modify the XML formatted file:

1 <!--from:-->
2 <translation type="Unfinished"></translation>
3 <!--to:-->
4 <translation>Translated Chars</translation>

in the project location, call the lrelease.exe in the desired version folder's bin as:

1 lrelease.exe *tr_*.ts

copy the generated *tr_*.qm file to the release folder with the main application and done.

posted on 2016-04-20 16:24  三叁  阅读(210)  评论(0编辑  收藏  举报

导航