Chinaunix首页 | 论坛 | 博客
  • 博客访问: 408331
  • 博文数量: 117
  • 博客积分: 5235
  • 博客等级: 大校
  • 技术积分: 1775
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-12 15:51
文章分类

全部博文(117)

文章存档

2012年(9)

2011年(2)

2010年(21)

2009年(13)

2008年(72)

我的朋友

分类: C/C++

2012-02-28 16:56:12

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
       
  1. QTranslator qtTranslator;
  2. qtTranslator.load("ts_file_path.qm");
  3. app.installTranslator(&qtTranslator);
阅读(1380) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~