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

QLocale::uiLanguages() returns english language if run from Finder

    XMLWordPrintable

Details

    • macOS
    • a5a68b29e (tqtc/lts-5.15)

    Description

       Qt APIs(QLocale::system().uiLanguages(), QLocale::system().name()) are returning locale differently based on the way the application is launched.

      • If the application is launched from Finder, locale returns English as preferred even when preferred is set to Japanese in system settings
      • If application is launched from Terminal, locale returns properly and it's as per the preferred language set in system settings
        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv);
            QLocale qLocale = QLocale::system();
            QStringList uiLanguages = qLocale.uiLanguages();
            qDebug()<<uiLanguages;
          
            return a.exec();
        }

        Steps,

      • Change the System Preferred Language to Japanese and Region to Japan.
      • Just make sure there is only one preferred Language i.e. Japanese.
      • restart machine.
      • Then run above code 

      Expectation is that it should return an array with languages and first should be Japanese.

      ("ja-JP", "ja", "ja-Jpan-JP", "en-JP", "en", "en-US", "en-Latn-US")
      But result of qLocale.uiLanguages() is "en", "en-US", "en-Latn-US", "ja-JP", "ja", "ja-Jpan-JP"

      Looks like similar bug fixed in past:
      https://bugreports.qt.io/browse/QTBUG-63324

      Attachments

        Issue Links

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

          Activity

            People

              vestbo Tor Arne Vestbø
              irfan.omair@digia.com Irfan Omair
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes