What:
QTranslator can load a .ts file which include all string from tr() for dest location, e.g: Chinese.
How:
1. tr("all string including %1").arg("abc")
2. Setup .pro file
TRANSLATIONS += app_en.ts app_zh.ts
3. Generate .ts files
lupdate *.pro
4. Translate
linguist (A UI tool to translate .ts items), release it get a .qm file
5. Load special .qm file in application code
- QTranslator qtTranslator;
- qtTranslator.load("ts_file_path.qm");
- app.installTranslator(&qtTranslator);
阅读(1441) | 评论(0) | 转发(0) |