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. QFileDialog QTranslator
Forum Updated to NodeBB v4.3 + New Features

QFileDialog QTranslator

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 378 Views 1 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.
  • R Offline
    R Offline
    retconx
    wrote on last edited by retconx
    #1

    Relatively new to QT for Python I am wondering if there is a way to get a QFileDialog in German language on MacOS.

    With

    app = QApplication(sys.argv)
    qt = QTranslator()
    print(qt.load("qtbase_de", QLibraryInfo.location(QLibraryInfo.LibraryPath.TranslationsPath))
    app.installTranslator(qt)

    I get "True" printed. So, I think the German qm-file is loaded successfully. Unfortunately the buttons (Open, Cancel, New Folder) and all the labels are still in English.

    Thanks for any help!

    SGaistS 1 Reply Last reply
    0
    • R retconx

      Relatively new to QT for Python I am wondering if there is a way to get a QFileDialog in German language on MacOS.

      With

      app = QApplication(sys.argv)
      qt = QTranslator()
      print(qt.load("qtbase_de", QLibraryInfo.location(QLibraryInfo.LibraryPath.TranslationsPath))
      app.installTranslator(qt)

      I get "True" printed. So, I think the German qm-file is loaded successfully. Unfortunately the buttons (Open, Cancel, New Folder) and all the labels are still in English.

      Thanks for any help!

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Is your OS configured for German ?

      By default, Qt uses the native file dialog so it will likely be show in the system language.

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

      R 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Is your OS configured for German ?

        By default, Qt uses the native file dialog so it will likely be show in the system language.

        R Offline
        R Offline
        retconx
        wrote on last edited by retconx
        #3

        Yes, it is.

        I noticed three things in the meantime:
        First, running the app leads to the following Warning:
        DeprecationWarning: Function: 'QLibraryInfo.location(QLibraryInfo.LibraryPath location)' is marked as deprecated, please check the documentation for more information.
        directory = QLibraryInfo.location(QLibraryInfo.LibraryPath.TranslationsPath)

        Secondly, print(Locale.system().name() outputs en_DE (I expected de_DE).

        Thirdly, curiously the application menu (Services, Hide Python, Hide Others...) IS translated to German! QTranslator seems to work generally, but does not affect QFileDialog.

        R 1 Reply Last reply
        0
        • R retconx

          Yes, it is.

          I noticed three things in the meantime:
          First, running the app leads to the following Warning:
          DeprecationWarning: Function: 'QLibraryInfo.location(QLibraryInfo.LibraryPath location)' is marked as deprecated, please check the documentation for more information.
          directory = QLibraryInfo.location(QLibraryInfo.LibraryPath.TranslationsPath)

          Secondly, print(Locale.system().name() outputs en_DE (I expected de_DE).

          Thirdly, curiously the application menu (Services, Hide Python, Hide Others...) IS translated to German! QTranslator seems to work generally, but does not affect QFileDialog.

          R Offline
          R Offline
          retconx
          wrote on last edited by retconx
          #4

          Update to the DeprecationWarning:
          Using QLibraryInfo.path(QLibraryInfo.LibraryPath.TranslationsPath) the warning is gone.

          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