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

QT Linguist tool not picking up right translation

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt 5translation
4 Posts 2 Posters 816 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 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++

    Christian EhrlicherC 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher moved this topic from Language Bindings on
    • T TechieTab

      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++

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #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
      0
      • Christian EhrlicherC Christian Ehrlicher

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

        T Offline
        T Offline
        TechieTab
        wrote on last edited by TechieTab
        #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

        Christian EhrlicherC 1 Reply Last reply
        0
        • T TechieTab

          @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

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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

          • Login

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