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. QT Linguist tool not picking up right translation
QtWS25 Last Chance

QT Linguist tool not picking up right translation

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt 5translation
4 Posts 2 Posters 403 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.
  • T Offline
    T Offline
    TechieTab
    wrote on 9 Nov 2023, 10:36 last edited by
    #1

    I am trying to use Translation feature in QT. There are more than 4000 translation needed to be done for one language. And I have to do this for more than 15 different languages. So, I decide to write language.ts files by shell scripts. After generating my language.ts succesfully, I open the file in notepad++ (in windows) and I can see the expected translation in the file. For example, in Brazilian language, following is the translation code is language.tsfile:-

    <message>
    <location filename="temp_unit.ui" line="59"/>
    <source>Cancel</source>
    <translation>Отказ</translation>
    </message>
    

    Now when I try open the file in QT Linguist tool, I got following error:-

    Parse error at lang_Brazil.ts:1:38:Encountered incorrectly encoded content.
    

    As details provided in this website, I replace encoding value utf-8 with ISO-8859-1 . Now I can open the file in QT Linguist but the translation is showing wrong characters, ex:- for Cancel it is showing Îòêàç (expected translation is Отказ).

    Please confirm why it is not taking right translation in QT linguist while I can see it if I open language.ts file in notepad++

    C 1 Reply Last reply 9 Nov 2023, 11:25
    0
    • C Christian Ehrlicher moved this topic from Language Bindings on 9 Nov 2023, 11:24
    • T TechieTab
      9 Nov 2023, 10:36

      I am trying to use Translation feature in QT. There are more than 4000 translation needed to be done for one language. And I have to do this for more than 15 different languages. So, I decide to write language.ts files by shell scripts. After generating my language.ts succesfully, I open the file in notepad++ (in windows) and I can see the expected translation in the file. For example, in Brazilian language, following is the translation code is language.tsfile:-

      <message>
      <location filename="temp_unit.ui" line="59"/>
      <source>Cancel</source>
      <translation>Отказ</translation>
      </message>
      

      Now when I try open the file in QT Linguist tool, I got following error:-

      Parse error at lang_Brazil.ts:1:38:Encountered incorrectly encoded content.
      

      As details provided in this website, I replace encoding value utf-8 with ISO-8859-1 . Now I can open the file in QT Linguist but the translation is showing wrong characters, ex:- for Cancel it is showing Îòêàç (expected translation is Отказ).

      Please confirm why it is not taking right translation in QT linguist while I can see it if I open language.ts file in notepad++

      C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 9 Nov 2023, 11:25 last edited by Christian Ehrlicher 11 Sept 2023, 11:25
      #2

      @TechieTab I would guess your script creates the ts files with another encoding than utf-8.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      T 1 Reply Last reply 9 Nov 2023, 11:37
      0
      • C Christian Ehrlicher
        9 Nov 2023, 11:25

        @TechieTab I would guess your script creates the ts files with another encoding than utf-8.

        T Offline
        T Offline
        TechieTab
        wrote on 9 Nov 2023, 11:37 last edited by TechieTab 11 Sept 2023, 11:38
        #3

        @Christian-Ehrlicher I just checked, It is ISO-8859-1. That's the format provided by file from which I am getting my translation. How to adjust QT accordingly? I am not sure of that

        C 1 Reply Last reply 9 Nov 2023, 16:07
        0
        • T TechieTab
          9 Nov 2023, 11:37

          @Christian-Ehrlicher I just checked, It is ISO-8859-1. That's the format provided by file from which I am getting my translation. How to adjust QT accordingly? I am not sure of that

          C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 9 Nov 2023, 16:07 last edited by
          #4

          @TechieTab said in QT Linguist tool not picking up right translation:

          How to adjust QT accordingly?

          I don't know why you want to adjust Qt here. The ts-file needs to be UTF-8 so fix your script, Latin1 can not be used here - Отказ can not be displayed with the latin1-charset so I doubt you're using latin1 at all...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0

          1/4

          9 Nov 2023, 10:36

          • Login

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