Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.15.16
-
-
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
- duplicates
-
QTBUG-63324 iOS/macOS: system localization always returns english language
- Closed