QTranslator ru-en && UTF-8



  • I'm trying to translate my application from Russian to English language. As far as my source code contains text in UTF-8 I have added the following lines to my .pro file:

    CODECFORTR = UTF-8
    CODECFORSRC = UTF-8
    TRANSLATIONS += app_en.ts
    

    But when I tried to load and install compiled translation file nothing had happened - application interface was in Russian.
    Than I tried to remove the first 2 lines from project file, and application interface was translated correctly. The problem is after these lines were removed my .ts translation file contains unreadable characters instead of russian - so it was very hard to translate it. How to cope with this?


  • Lifetime Qt Champion

    Hi,

    What about if you set only CODECFORTR ?



  • @SGaist No, that doesn't help. The problem was solved when I tried to use translation utilities from qt5 packet (previously I was trying to use qt4 utilities). lupdate generated .ts file with correct russian symbols and lrelease compiled loadable .qm file.


  • Lifetime Qt Champion

    Glad you found out and thanks for sharing !

    So you were mixing the tools of the two Qt versions ?



  • @SGaist Not quite...I was using lupdate and linguist from the same qt version - 4.8.6. Moreover this - I was trying to generate translation file for two platforms - win10 and ubuntu 15.10 with the same result. So finally I used qt5.6 lupdate to generate .ts file, qt4.8.6 linguist as interface to translate UI and qt5.6 lrelease to compile .qm - that works for me.


  • Lifetime Qt Champion

    Qt 5.6 should also have linguist so you don't have to use two different version of Qt.



  • @SGaist That is true, thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.