From 15ff5cfedd4e69dd76d6ced885d752daee10aeef Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 4 Dec 2017 16:42:32 +0100 Subject: 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) Reviewed-by: Lars Knoll --- src/corelib/tools/qlocale.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/corelib') 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 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)) { -- cgit v1.2.3