summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2017-12-04 16:42:32 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2018-04-19 14:19:37 +0000
commit15ff5cfedd4e69dd76d6ced885d752daee10aeef (patch)
tree4c6efd4936604a015ac6b4f233a8faddf56bc90d
parent8c80dad4b5388e81b6644b274c704272dcd21337 (diff)
Prefer the raw data, if it specifies a locale, before shedding tags
QLocaleData::findLocaleData() was checking its given data with likely tags filled in, but not checking it without; then it went on to blot out some of the given data with Any, checking first with likely tags then without. The lack of this second step with the full data seemed misguided. Change-Id: I58ee09f5a2a3355446333fc9985a2fb818491e2f Reviewed-by: Jason Erb (Suitable Technologies) <erb@suitabletech.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/tools/qlocale.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 7870e31342..9c1e78ee61 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -390,6 +390,13 @@ const QLocaleData *QLocaleData::findLocaleData(QLocale::Language language, QLoca
QList<QLocaleId> tried;
tried.push_back(likelyId);
+ // No match; try again with raw data:
+ if (!tried.contains(localeId)) {
+ if (const QLocaleData *const data = findLocaleDataById(localeId))
+ return data;
+ tried.push_back(localeId);
+ }
+
// No match; try again with likely country
if (country != QLocale::AnyCountry
&& (language != QLocale::AnyLanguage || script != QLocale::AnyScript)) {