当前位置:网站首页>QT language file production
QT language file production
2022-08-05 02:46:00 【rainbow_lucky0106】
Purpose
Extract the text in the code to facilitate subsequent changes according to user requirements.
Steps
- Add language file path to .pro file
TRANSLATIONS += .\tcd_language_English.ts \.\tcd_language_Chinese.ts
Generate ts: select Tools > External > Qt Linguist > Update Translation in QTCreate
View ts files with Linguist that comes with QT.In the pop-up language translation interface, add the appropriate translation language.
Publish and generate qm files: in QTCreate, select Tools > External > Qt Linguist > publish translation.
Add the generated qm file to the resource file .qrc.
The code is loaded into the program.
// Multiple qm language files added: use multiple QTranslator objectsQTranslator SysTranslator1;QTranslator SysTranslator2;SysTranslator1.load(QString(":/Resource/qt_zh_CN.qm"));SysTranslator2.load(QString(":/Resource/tcd_language_English.qm"));a.installTranslator(&SysTranslator1);a.installTranslator(&SysTranslator2);
How to update
- Find the corresponding entry in QT Linguist to modify.
- Fill in the translation information.
Tricks
The string in tr() is a variable: tr("%1").arg()
tr(QString())
will cause QT Linguist to not recognize
If the source text has variables in the code, it may or may not be written in the translated text.
Source text: tr("The preset time has been recorded %1min").arg(time);
The translation text can be written as: tr("The preset time is up.")
or tr("Default %1 minutes.")
边栏推荐
- Gantt chart is here, project management artifact, template is used directly
- View handler stepping record
- [深入研究4G/5G/6G专题-51]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-11-高可靠性技术-2-链路自适应增强(根据无线链路状态动态选择高可靠性MCS)
- 蚁剑高级模块开发
- nodeJs--encapsulate routing
- Advanced Numbers_Review_Chapter 1: Functions, Limits, Continuity
- nodeJs--封装路由
- [ROS](10)ROS通信 —— 服务(Service)通信
- 2022-08-04: Input: deduplicated array arr, the numbers in it only contain 0~9.limit, a number.Return: The maximum number that can be spelled out with arr if the requirement is smaller than limit.from
- Ant Sword Advanced Module Development
猜你喜欢
Common hardware delays
Intel XDC 2022 Wonderful Review: Build an Open Ecosystem and Unleash the Potential of "Infrastructure"
01 [Foreword Basic Use Core Concepts]
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
Matlab map with color representation module value size arrow
J9数字货币论:web3的创作者经济是什么?
DAY23:命令执行&代码执行漏洞
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
Study Notes-----Left-biased Tree
倒计时 2 天|云原生 Meetup 广州站,等你来!
随机推荐
select 标签自定义样式
C学生管理系统 指定位置插入学生节点
View handler stepping record
正则表达式,匹配中间的某一段字符串
注意潍坊开具发票一般需要注意
UOS系统下ksql应用缺少动态库”libtinfo.so.5“问题
[深入研究4G/5G/6G专题-51]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-11-高可靠性技术-2-链路自适应增强(根据无线链路状态动态选择高可靠性MCS)
人人都在说的数据中台,你需要关注的核心特点是什么?
C language implements a simple number guessing game
HDU 1114:Piggy-Bank ← 完全背包问题
leetcode 15
1527. Patients suffering from a disease
C语言实现简单猜数字游戏
北斗三号短报文终端露天矿山高边坡监测方案
Programmer's Tanabata Romantic Moment
01 [Foreword Basic Use Core Concepts]
Matlab画图3
ARM Mailbox
云原生(三十二) | Kubernetes篇之平台存储系统介绍
J9数字货币论:web3的创作者经济是什么?