Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Using pyside2-lupdate to update strings in .ts file
Forum Updated to NodeBB v4.3 + New Features

Using pyside2-lupdate to update strings in .ts file

Scheduled Pinned Locked Moved Solved Qt for Python
4 Posts 2 Posters 626 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.
  • J Offline
    J Offline
    JesusM97
    wrote on last edited by JesusM97
    #1

    Hi, I have a .ts file where I have made the translations of my program to English. The strings of my program are written in Spanish and I generated a first version .ts file in UTF-8 to translate all the strings to English through Qt Linguist.
    I have added new strings to the program and I would like to add them to the .ts file without overwriting the existing translations. I have run the same command again on the file that already has translations and this time the UTF8 characters are not being added correctly (they are added as symbols). On the other hand if I recreate the file from 0 there is no problem but I lose all the translations I already had.

    The command I am using is

    pyside2-lupdate project.pro
    

    The content of project. pro file is:

    CODECFORTR = UTF-8
    
    SOURCES = VRConfigurator/__init__.py
    
    TRANSLATIONS = VRConfigurator/translations/en_GB.ts
    
    CristianMaureiraC 1 Reply Last reply
    0
    • J JesusM97

      Hi, I have a .ts file where I have made the translations of my program to English. The strings of my program are written in Spanish and I generated a first version .ts file in UTF-8 to translate all the strings to English through Qt Linguist.
      I have added new strings to the program and I would like to add them to the .ts file without overwriting the existing translations. I have run the same command again on the file that already has translations and this time the UTF8 characters are not being added correctly (they are added as symbols). On the other hand if I recreate the file from 0 there is no problem but I lose all the translations I already had.

      The command I am using is

      pyside2-lupdate project.pro
      

      The content of project. pro file is:

      CODECFORTR = UTF-8
      
      SOURCES = VRConfigurator/__init__.py
      
      TRANSLATIONS = VRConfigurator/translations/en_GB.ts
      
      CristianMaureiraC Offline
      CristianMaureiraC Offline
      CristianMaureira
      wrote on last edited by
      #2

      @JesusM97 is there any constraint on the version? pyside2-lupdate was a bit outdated back in the day, and it was a python adaptation of lupdate. I remember many bug reports on it, so if you are free to use a newer version, please use PySide6, we include pyside6-lupdate which is the same C++ lupdate tool with some extra options to use Python with it. For sure less buggy, and more up-to-date.

      With that being said, we have a short tutorial on the i18n topic in https://doc.qt.io/qtforpython-6/tutorials/basictutorial/translations.html I hope it's useful.

      J 2 Replies Last reply
      3
      • CristianMaureiraC CristianMaureira

        @JesusM97 is there any constraint on the version? pyside2-lupdate was a bit outdated back in the day, and it was a python adaptation of lupdate. I remember many bug reports on it, so if you are free to use a newer version, please use PySide6, we include pyside6-lupdate which is the same C++ lupdate tool with some extra options to use Python with it. For sure less buggy, and more up-to-date.

        With that being said, we have a short tutorial on the i18n topic in https://doc.qt.io/qtforpython-6/tutorials/basictutorial/translations.html I hope it's useful.

        J Offline
        J Offline
        JesusM97
        wrote on last edited by
        #3

        @CristianMaureira I'll make a backup of the project and try to update it to PySide-6 to see if it doesn't give me too many problems.
        It's a fairly advanced project that I started with PySide2 just because almost all the tutorials I found were for that version. If I succeed, I'll try again to make the translation and I'll comment if I get the same error.

        1 Reply Last reply
        0
        • J JesusM97 has marked this topic as solved on
        • CristianMaureiraC CristianMaureira

          @JesusM97 is there any constraint on the version? pyside2-lupdate was a bit outdated back in the day, and it was a python adaptation of lupdate. I remember many bug reports on it, so if you are free to use a newer version, please use PySide6, we include pyside6-lupdate which is the same C++ lupdate tool with some extra options to use Python with it. For sure less buggy, and more up-to-date.

          With that being said, we have a short tutorial on the i18n topic in https://doc.qt.io/qtforpython-6/tutorials/basictutorial/translations.html I hope it's useful.

          J Offline
          J Offline
          JesusM97
          wrote on last edited by
          #4

          @CristianMaureira I have updated the whole application to PySide6 and now it generates well the .ts file with UTF8 encoding and updating correctly the text strings.

          Thank you very much!

          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