Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-137871

Standard button texts in Dialog are not translated to zh_CN unless qtmultimedia_zh_CN.qm is present/bundled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.2
    • Translations (l10n)
    • None
    • Windows 11 23H2
      Python 3.12.4
      PySide6 6.8.2.1
      PyInstaller 6.13.0
      Nuitka 2.5.1
    • All

    Description

      Steps to Reproduce

       export LC_ALL=zh_CN.UTF-8
      qml qtbug137871.qml
      
      • Observe buttons are translated
      • Remove files translations/qtmultimedia_zh_*qm from the Qt installation
      • Launch app again: Note buttons are no longer translated

      It looks like an ambiguous context/message

      Original report against PySide

      When a PySide6 Qt Quick application is deployed as a frozen executable (with PyInstaller or Nuitka) under the zh_CN locale, the standard button captions generated by QtQuick.Controls.Dialog (OK, Cancel, etc.) remain in English. The translations appear only if the file qtmultimedia_zh_CN.qm is shipped alongside the executable, even though the application itself does not import or use qtmultimedia.

      Steps to Reproduce

      1. Unzip the attached example, build it with pyinstaller or nuitka under standalone mode, do not manually copy any .qm files.
        Freezing command (example, PyInstaller):
      pyinstaller main.py
      
      1. Run the generated executable on a system whose locale is Simplified Chinese or call QLocale.setDefault("zh_CN") as in the example.
      2. Observe the dialog buttons: English (OK, Cancel).
      3. Copy qtmultimedia_zh_CN.qm from the PySide6 installation’s translations/ directory into the same relative path under the frozen app.
      4. Run again, buttons now show Chinese (确定, 取消).

      Expected Behavior
      Dialog standard buttons should be translated to Chinese as long as the core translation files (qtbase_zh_CN.qm, qtquickcontrols2_zh_CN.qm, etc.) are present. Translations should not depend on the presence of any qtmultimedia translation files when the module is not used.

      Actual Behavior
      Without qtmultimedia_zh_CN.qm, button texts remain in English.

      Attachments

        1. qtbug137871.qml
          0.3 kB
        2. PYSIDE-3123.zip
          0.5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            tian Zhiyuan Tian
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes