diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-01-21 15:01:55 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-01-22 22:16:50 +0100 |
commit | 0b28f1e3bae10def59e7fe8afac29ed5355a3f1e (patch) | |
tree | 008b8e14165c43a2aa56291da296ca7ce7faa4f2 | |
parent | d0e9e5a36e3e49ec9fb0fb3f1639c21e7414c615 (diff) | |
download | qtbase-0b28f1e3bae10def59e7fe8afac29ed5355a3f1e.tar.gz |
Fix QLocale::system() and uiLanguages() for the mobile platforms
On iOS, it was no longer using the Cocoa specific code needed to get
the locale and uiLanguages information so this functionality is brought
back as it was accidently lost.
In addition, this has a side-effect of fixing a problem with Android
versions below API 24 where it has no UiLanguages functionality so it
gets the information based on the system locale as a fallback.
Fixes: QTBUG-81307
Fixes: QTBUG-81357
Change-Id: I1709675b5bd5e9cedefb99eaec28279f20a347a4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r-- | src/corelib/text/qlocale.cpp | 2 | ||||
-rw-r--r-- | src/corelib/text/text.pri | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index e3530eeee1..d8c4b41624 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -4463,6 +4463,8 @@ QStringList QLocale::uiLanguages() const for (const auto entry : qAsConst(uiLanguages)) locales.append(QLocale(entry)); } + if (locales.isEmpty()) + locales.append(systemLocale()->fallbackUiLocale()); } else #endif { diff --git a/src/corelib/text/text.pri b/src/corelib/text/text.pri index 25e281f37a..d2a02059c7 100644 --- a/src/corelib/text/text.pri +++ b/src/corelib/text/text.pri @@ -48,7 +48,7 @@ SOURCES += \ NO_PCH_SOURCES += text/qstring_compat.cpp false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator -!nacl:macos: { +!nacl:darwin: { SOURCES += text/qlocale_mac.mm } else:unix { |