How to localize qdbusviewer?
-
I wanted to translate Qt qdbusviewer, this is what I did:
cd /home/kate/Downloads/qt-everywhere-src-5.13.0/qttools/src/qdbus
lupdate qdbus.pro -ts qdbus_zh_TW.ts
After I translated all strings, did:
lrelease qdbus_zh_TW.ts
sudo mv qdbus_zh_TW.qm /usr/share/qt/translations -
@katelam said in How to localize qdbusviewer?:
qdbusviewer
As @closx suggested, you need to make the .pro file aware of new translations.
- From source code tree add a new folder translations
- update qdbusviewer.pro file with:
TRANSLATIONS += $$PWD/translations/qdbusviewer_zh_TW.ts
- Extract the translatable strings (the ones inside a tr() method call...). This step will create (or update later) the file(s) to translate (i.e. qdbusviewer_zh_TW.ts)
lupdate qdbusviewer.pro
- Using Qt Linguist translate the file(s)
- Create the .qm files (binary representation of .ts files)
lrelease qdbusviewer.pro
- Use the translations. You need to change qdbusviewer to upload/install the proper .qm file (i.e. change main.cpp to do that)
I'm just referering to qdbusviewer folder since qdbus has no tr() method calls at all
-
Thanks, pablo-j-rogina. I know how to generate ts and qm files, but I don't know how to make Qt qdbusviewer use my translations. It didn't apply my translation. I went to see "About Qt", I found Qt qdbusviewer also didn't apply translations I ever made in qtbase_zh_TW.ts at all. Qt assistant,designer and linguist doesn't have these problems and works with my translations very well.