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:

 //*.pro
TRANSLATIONS += *tr_chn.ts
TRANSLATIONS += *tr_la.ts
...

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

 lupdate *.pro

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

 <!--from:-->
<translation type="Unfinished"></translation>
<!--to:-->
<translation>Translated Chars</translation>

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

 lrelease.exe *tr_*.ts

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

上一篇:【缓存】Sql Server 2005/2008 SqlCacheDependency查询通知的使用总结


下一篇:深入理解Java虚拟机(六)——JVM调优分析与实战