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. translator files platform dependent?
Forum Updated to NodeBB v4.3 + New Features

translator files platform dependent?

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 399 Views 2 Watching
  • 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.
  • MasterQM Offline
    MasterQM Offline
    MasterQ
    wrote on last edited by MasterQ
    #1

    Hi

    I put the translator file qtbase_de.qm in a resource file to embed it into my code.

    Loading the file on Linux is working fine. But same code on Windows fails.

    Code:

        qtTranslator = QTranslator()
        qDebug("Translator " + "exists" if QFile.exists(":/assets/qtbase_de.qm") else "exists not")
        if qtTranslator.load(":/assets/qtbase_de.qm"):
            qDebug(f"Translator installed: {qtTranslator.language()}")
        else:
            qDebug("no Translator installed")
    

    Linux:

    2024-11-21 13:53:53.627 [debug] JHXManager.unknown : Translator exists
    2024-11-21 13:53:53.628 [debug] JHXManager.unknown : Translator installed: de_DE
    

    Windows:

    2024-11-21 13:54:35.146 [debug] JHXManager.unknown : Translator exists
    2024-11-21 13:54:35.146 [debug] JHXManager.unknown : no Translator installed
    

    In both cases, Linux and Windows, the file can be loaded from rc file, but why fails qtTranslator.load on Windows?

    I made a diff of the file from PySide6 on Linux and on Windows. The files are identical.

    What is wrong?

    J.

    jsulmJ 1 Reply Last reply
    0
    • MasterQM MasterQ

      Hi

      I put the translator file qtbase_de.qm in a resource file to embed it into my code.

      Loading the file on Linux is working fine. But same code on Windows fails.

      Code:

          qtTranslator = QTranslator()
          qDebug("Translator " + "exists" if QFile.exists(":/assets/qtbase_de.qm") else "exists not")
          if qtTranslator.load(":/assets/qtbase_de.qm"):
              qDebug(f"Translator installed: {qtTranslator.language()}")
          else:
              qDebug("no Translator installed")
      

      Linux:

      2024-11-21 13:53:53.627 [debug] JHXManager.unknown : Translator exists
      2024-11-21 13:53:53.628 [debug] JHXManager.unknown : Translator installed: de_DE
      

      Windows:

      2024-11-21 13:54:35.146 [debug] JHXManager.unknown : Translator exists
      2024-11-21 13:54:35.146 [debug] JHXManager.unknown : no Translator installed
      

      In both cases, Linux and Windows, the file can be loaded from rc file, but why fails qtTranslator.load on Windows?

      I made a diff of the file from PySide6 on Linux and on Windows. The files are identical.

      What is wrong?

      J.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @MasterQ Do you have any platform specific sections in your pro or CMakeLists.txt?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • MasterQM Offline
        MasterQM Offline
        MasterQ
        wrote on last edited by
        #3

        this is Python!

        No, I do not have any platform specific code ... so far

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

          Hi,

          Are you using the same version of PySide/PyQt on both OS ?

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

          1 Reply Last reply
          0
          • MasterQM Offline
            MasterQM Offline
            MasterQ
            wrote on last edited by MasterQ
            #5

            Yes, it is PySide 6.8.0.2 on both OS.

            But on Linux I use Python 3.12 and on Windows 3.13

            --Edit: --
            the Python version doesn't matter!, Just tested.

            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