Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTranslator ru-en && UTF-8
QtWS25 Last Chance

QTranslator ru-en && UTF-8

Scheduled Pinned Locked Moved Solved General and Desktop
qtranslatorutf-8encoding
7 Posts 2 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 0 Offline
    0 Offline
    0...-5
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What about if you set only CODECFORTR ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      0 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What about if you set only CODECFORTR ?

        0 Offline
        0 Offline
        0...-5
        wrote on last edited by 0...-5
        #3

        @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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Glad you found out and thanks for sharing !

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          0 1 Reply Last reply
          0
          • SGaistS SGaist

            Glad you found out and thanks for sharing !

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

            0 Offline
            0 Offline
            0...-5
            wrote on last edited by
            #5

            @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.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              0 1 Reply Last reply
              0
              • SGaistS SGaist

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

                0 Offline
                0 Offline
                0...-5
                wrote on last edited by
                #7

                @SGaist That is true, thanks!

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved