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

Qt Quick should use QLocale::uiLanguages() for loading translations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.12.0
    • 5.11.1
    • Quick: Other
    • None

    Description

      qmlscene, qml, but also QQmlApplicationEngine do allow automatic loading and installation of .qm files for the respective UI. This is done by checking QLocale::system().name().

      There are two problems with that:

      • QQmlApplicationEngine ignores any locale enforced by QLocale::setDefault()
      • QLocale::system() is actually specifying the decimal/grouping characters and date/time formats specified in the system configuration panel, not the UI language.

      The QLocale documentation therefore recommends using QLocale::uiLanguages() instead, by using the convenience method QTranslator::install(QLocale, ...)

      One problematic side-effect about changing this though is that it ignores the language of the translation sources; that is, if the sources are in English, but there's no en.qm translation file, it might be that a secondary language translation is loaded.

      Anyhow, for Qt we have been providing empty English translations, and should endorse our users to do so, too.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-69196
          # Subject Branch Project Status CR V

          Activity

            People

              kkohne Kai Köhne
              kkohne Kai Köhne
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews