天天看點

Linguist的使用 實作Qt文本翻譯

1、配置環境Linguist(設定路徑)  配置後直接調用

Linguist的使用 實作Qt文本翻譯

2、配置輸出檔案和資源檔案

TRANSLATIONS += project_en.ts

Linguist的使用 實作Qt文本翻譯
Linguist的使用 實作Qt文本翻譯

3、調用lupdate生成ts原始翻譯文本

Linguist的使用 實作Qt文本翻譯

4、打開Linguist工具 

手動翻譯需要翻譯的文本

Linguist的使用 實作Qt文本翻譯

5、翻譯完成後調用lrelease完成釋出生成qm檔案

    添加到資源檔案中

6、加載qm檔案

     QTranslator qtTranslatorStandard;

       qtTranslatorStandard.load("://project_en.qm");//加載資源檔案中的翻譯檔案

       a.installTranslator(&qtTranslatorStandard);//安裝翻譯工具

效果如下

Linguist的使用 實作Qt文本翻譯
Linguist的使用 實作Qt文本翻譯

繼續閱讀