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>
This commit is contained in:
Edward Welbourne 2017-12-04 16:42:32 +01:00
parent 8c80dad4b5
commit 15ff5cfedd

View File

@ -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)) {