Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2419

QLocale::name and QLocale::bcp47Name outputs are incorrect on non-English system

XMLWordPrintable

    • macOS
    • 35c96115c (dev), 0175fcf36 (6.5), cc37ef66f (tqtc/lts-6.2)

      A minimal reprodcer:

      # This Python file uses the following encoding: utf-8
      import sys
      from PySide6.QtWidgets import QApplication
      from PySide6.QtCore import QLocale
      
      if __name__ == "__main__":
          app = QApplication(sys.argv)
      
          locale = QLocale.system()
          print(locale.bcp47Name())
          print(locale.name())
          sys.exit(app.exec())
      

      On, for example, Japanese system, the outputs are still en-JP and en_JP. The C++ APIs output ja and ja_JP, which is correct. Also, PySide6 on Windows outputs the correct names, i.e. ja and ja_JP. So in short, PySide6 on macOS does not handle locales correctly.

      BTW, a more straightforward test:

      locale.language()
      

      returns Language.English for Japanese macOS.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            shpremna Shyamnath Premnadh
            luqiaochen Luqiao Chen
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes