使用Qt Linguist

应用程序中需要翻译的文本大部分由单个词或短语组成。这些通常出现在窗口标题、菜单项、工具提示以及按钮、复选框和单选按钮的标签中。

您需要在 Qml 和 C++ 源代码中将这些短语标记为可翻译。Qt 本地化工具会为每个短语提供上下文信息,以帮助译者理解其含义。您还可以在短语中添加注释。

翻译文件包含应用程序中所有用户可见的文本和键盘快捷键,以及这些文本的翻译内容。

创建新项目时,可以为一种语言自动生成翻译源文件(TS)。要添加其他语言,请编辑项目文件,或转至“File ” > “New File ”。

要在Qt Linguist 中打开TS文件,请在“Projects ”或“File System ”视图中右键单击TS文件,然后在上下文菜单中选择“Open With ” > Qt Linguist

另请参阅 “添加翻译文件”“使用 Qt XML 进行国际化”以及《Qt Linguist 手册》

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.