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

qtranslator loads wrong locale

XMLWordPrintable

    • Android
    • 7f9ee43de (dev), 45c9a35d3 (6.9), 631fa1915 (6.9), b4bc68997 (dev), bfa23b1f7 (6.9), 1f55a339d (6.8), 0a0df7df9 (6.8), b61228669 (dev), 8c9358761 (6.9), 0278a80d6 (dev), b5b172e34 (6.9), dabc113cc (dev), 9911f7c90 (6.9), ede2605bc (tqtc/lts-6.8)
    • Foundation Sprint 123

      After recompiling and deploying my app to the latest Qt, the behavior changed;
      in Qt 65x the language "en" was picked, in Qt681 the language "nl" is picked.

      Locale.uiLangages shows:
      `en-NL, en-Latn-NL, nl-NL, nl-Latn-NL, nl, en-US, en-Latn-US, en'

      the qrc contains both an 'en' and an 'nl' qm file, the 'nl' is being picked. I confirmed this by printing the translator->language() and filePath().

      auto *translator = new QTranslator(&qapp);
      if (translator->load(QLocale(), "myApp", QLatin1String("_"), QLatin1String(":/i18n"))) {
          QCoreApplication::installTranslator(translator);
      

      Picking 'nl' is wrong as the phone has explicitly specified that the language of preference is 'en' (with NL localization). The uiLanguages output is correct, and unchanged between qt653 and qt681.

      This is a user-visible regression when compared to the previous LTS version.

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