diff options
author | JiDe Zhang <zhangjide@uniontech.com> | 2021-03-09 16:19:54 +0800 |
---|---|---|
committer | JiDe Zhang <zhangjide@uniontech.com> | 2021-04-15 20:17:49 +0800 |
commit | 50a7eb8cf75a2f9cebde6d0d23c108e5e7f1870b (patch) | |
tree | c947e4746bb55f723c4005534cb98501f083036a /src/corelib/text/qlocale_win.cpp | |
parent | 7c8d45cb2635ab44d85d85288fd74ef72909264c (diff) |
Add the "Territory" enumerated type for QLocale
The use of "Country" is misleading as some entries in the enumeration
are not countries (eg, HongKong), for all that most are. The Unicode
Consortium's Common Locale Data Repository (CLDR, from which QLocale's
data is taken) calls these territories, so introduce territory-based
names and prepare to deprecate the country-based ones in due course.
[ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for
its Country enumeration, and associated territory-based names to match
its country-named methods, to better match the usage in relevant
standards. The country-based names shall in due course be deprecated
in favor of the territory-based names.
Fixes: QTBUG-91686
Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qlocale_win.cpp')
-rw-r--r-- | src/corelib/text/qlocale_win.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index 664e82a5aa..c73e937581 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -107,7 +107,7 @@ struct QSystemLocalePrivate QVariant toCurrencyString(const QSystemLocale::CurrencyToStringArgument &); QVariant uiLanguages(); QVariant nativeLanguageName(); - QVariant nativeCountryName(); + QVariant nativeTerritoryName(); void update(); @@ -625,7 +625,7 @@ QVariant QSystemLocalePrivate::nativeLanguageName() return getLocaleInfo(LOCALE_SNATIVELANGUAGENAME); } -QVariant QSystemLocalePrivate::nativeCountryName() +QVariant QSystemLocalePrivate::nativeTerritoryName() { return getLocaleInfo(LOCALE_SNATIVECOUNTRYNAME); } @@ -757,13 +757,13 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const return d->zeroDigit(); case LanguageId: case ScriptId: - case CountryId: { + case TerritoryId: { QLocaleId lid = QLocaleId::fromName(QString::fromLatin1(getWinLocaleName())); if (type == LanguageId) return lid.language_id; if (type == ScriptId) return lid.script_id ? lid.script_id : ushort(fallbackLocale().script()); - return lid.country_id ? lid.country_id : ushort(fallbackLocale().country()); + return lid.territory_id ? lid.territory_id : ushort(fallbackLocale().territory()); } case MeasurementSystem: return d->measurementSystem(); @@ -786,8 +786,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const break; case NativeLanguageName: return d->nativeLanguageName(); - case NativeCountryName: - return d->nativeCountryName(); + case NativeTerritoryName: + return d->nativeTerritoryName(); default: break; } |