in .cpp file, wherever you want, wrap QString with a tr("somesz") rendering it ready to be translated.

in .pro file, specify the readable translation file:

 //*.pro
TRANSLATIONS += *tr_chn.ts
TRANSLATIONS += *tr_la.ts
...

in the project location, call the lupdate.exe in the the desired version folder's bin:

 lupdate *.pro

generated *tr_*.ts file, open them as .txt file, modify the XML formatted file:

 <!--from:-->
<translation type="Unfinished"></translation>
<!--to:-->
<translation>Translated Chars</translation>

in the project location, call the lrelease.exe in the desired version folder's bin as:

 lrelease.exe *tr_*.ts

copy the generated *tr_*.qm file to the release folder with the main application and done.

Qt 5.5 tr usage的更多相关文章

  1. 关于qt中的tr()函数

    关于qt中的tr()函数 在论坛中漂,经常遇到有人遇到tr相关的问题.用tr的有两类人: (1)因为发现中文老出问题,然后搜索,发现很多人用tr,于是他也开始用tr (2)另一类人,确实是出于国际化的 ...

  2. QT显示歌词渐变

    central = new QWidget(this); setCentralWidget(central); central->setAutoFillBackground(true); cen ...

  3. 【QT】C++ GUI Qt4 学习笔记3

    菜单界面的实现. 看书上第三章,好长,好多代码.我敲了半天,想看看效果,结果却显示不出来.仔细一看,发现spreadsheet的实现在第四章.郁闷.... 又到官网上下代码,结果居然不能运行.难道是因 ...

  4. Qt数据库操作(qt-win-commercial-src-4.3.1,VC6,Oracle,SQL Server)

    qt-win-commercial-src-4.3.1.qt-x11-commercial-src-4.3.1Microsoft Visual C++ 6.0.KDevelop 3.5.0Window ...

  5. Qt操作Oracle

    很久以前写过<Qt数据库操作>的一篇文章,在操作数据库的时候,温习了一下!感觉很好!但在操作Oracle数据库时又遇到了一些问题.在使用QSqlRelationalTableModel操纵 ...

  6. Qt根据汉字生成位图,可连续调用,生成的位图不会有杂点

    void MainWindow::drawText(int font_size, QString str, int n){ QPainter p; QSize size(460, font_size) ...

  7. 1.总结---tr()和QTextCodec对象

    1. 关于Qt 中的tr()函数-------http://tscsh.blog.163.com/blog/static/200320103201310213312518/ 在论坛中漂,经常遇到有人遇 ...

  8. QT 操作数据库

    整理一下 QT 操作数据库的一些要点,以备以后的查询学习(主要是操作 mysql ). 首先,要查询相关的驱动是否已经装好了,可以用以下的程序进行验证: #include <QtCore/QCo ...

  9. [Qt] searchBox 搜索框实现

    [Qt] searchBox 搜索框实现 也就是在lineEdit中加入button.在搜索框的右边会有个小小的搜索图标,输入内容之后,搜索的图标会变成叉叉. 类中的IconHelper见我的另一篇博 ...

随机推荐

  1. debian服务器上不了网,缺少默认网关

    debian服务器上不了网,缺少默认网关 root@hbg:/# route -nKernel IP routing tableDestination     Gateway         Genm ...

  2. Gentoo安装详解(二)-- 编译内核

    编译内核: 安装内核源码: 选择内核:如gentoo-sources emerge gentoo-sources ls -l /usr/src/linux 手动编译内核: cd /usr/src/li ...

  3. 多线程---同步函数的锁是this(转载)

    class Ticket implements Runnable { private int tick = 100; Object obj = new Object(); boolean flag = ...

  4. 【Linux】给Linux配置SNMP用户以及协议

    1 检查是否已经安装snmp的rpm包Ideploy:~ # rpm -aq | grep snmp libsnmp15-5.4.2.1-8.12.10.1 snmp-mibs-5.4.2.1-8.1 ...

  5. HttpClient模拟get,post请求并发送请求参数(json等)

    import java.io.IOException; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org. ...

  6. quicksort快排

    废话不多说,上代码: void quicksort(int x[], int lo, int hi){ int i = lo, j = hi; ]; while(i <= j){ while(x ...

  7. ASP.NET中的Excel操作(NPOI方式)

    代码准备: 一:实体准备 代码如下: /// <summary> /// 一个能添加到将要导出到指定行的实体类型规范 /// data:{int StartColIndex ? 0, in ...

  8. Centos 6.5升级到Git2.1.2的步骤

    Centos 6.5升级到Git2.1.2的步骤 Centos 6.5升级到Git2.1.2其实是非常的简单,因这款版本控制程序非常的好用,所以小编自己也是使用它了,下面一起来看看Centos 6.5 ...

  9. JavaScript(10)——Ajax以及跨域处理

    Ajax以及跨域处理 哈哈哈,终于写到最后一章了.不过也还没有结束,说,不要为了学习而学习,恩.我是为了好好学习而学习呀.哈哈哈.正在尝试爱上代码,虽然有一丢丢的难,不过,我相信我会的! [Ajax] ...

  10. android应用开发小技巧

    1,实现应用可以安装到SD卡里面去:在AndroidManifest.xml文件的manifest里面添加下面一行: 1 android:installLocation="preferExt ...