中文、英文资源示例放在后面。
- 启动Linguist

- 选择资源文件
点击上图中的打开,选择相关资源文件,效果如下:

- 转换为qm文件

看看资源目录下,产生了对应的qm文件。
-
中文资源
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="zh_CN"> <context> <name>MainWindow</name> <message> <location filename="../src/MainWindow.ui" line="50"/> <source>巍宇航天</source> <translation>巍宇航天</translation> </message> <message> <location filename="../src/MainWindow.ui" line="14"/> <source>无锡</source> <translation>无锡</translation> </message> <message> <location filename="../src/MainWindow.ui" line="14"/> <source>高浪东路启航大厦601</source> <translation>高浪东路启航大厦601</translation> </message> <message> <location filename="../src/MainWindow.ui" line="37"/> <source>选择语言</source> <translation>选择语言</translation> </message> </context> <context> <name></name> <message> <source>Chinese</source> <translation>中文</translation> </message> <message> <source>English</source> <translation>English</translation> </message> </context> </TS> -
英文资源
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="en_KG"> <context> <name>MainWindow</name> <message> <location filename="../src/MainWindow.ui" line="50"/> <source>巍宇航天</source> <translation>Wniverse Aerospace</translation> </message> <message> <location filename="../src/MainWindow.ui" line="14"/> <source>无锡</source> <translation>Wuxi</translation> </message> <message> <location filename="../src/MainWindow.ui" line="14"/> <source>高浪东路启航大厦601</source> <translation>601, Qihang building, Gaolang East Road</translation> </message> <message> <location filename="../src/MainWindow.ui" line="37"/> <source>选择语言</source> <translation>Select Language</translation> </message> </context> <context> <name></name> <message> <source>Chinese</source> <translation>中文</translation> </message> <message> <source>English</source> <translation>English</translation> </message> </context> </TS>