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 /tests/manual | |
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 'tests/manual')
-rw-r--r-- | tests/manual/qlocale/info.cpp | 8 | ||||
-rw-r--r-- | tests/manual/qlocale/info.h | 4 | ||||
-rw-r--r-- | tests/manual/qlocale/languages.cpp | 2 | ||||
-rw-r--r-- | tests/manual/qlocale/window.cpp | 10 |
4 files changed, 12 insertions, 12 deletions
diff --git a/tests/manual/qlocale/info.cpp b/tests/manual/qlocale/info.cpp index 4d082577d4..3f23403350 100644 --- a/tests/manual/qlocale/info.cpp +++ b/tests/manual/qlocale/info.cpp @@ -53,8 +53,8 @@ InfoWidget::InfoWidget() languageName = addItem("Language name:"); nativeLanguageName = addItem("Native language name:"); scriptName = addItem("Script name:"); - countryName = addItem("Country name:"); - nativeCountryName = addItem("Native country name:"); + territoryName = addItem("Territory name:"); + nativeTerritoryName = addItem("Native territory name:"); } void InfoWidget::localeChanged(QLocale locale) @@ -65,8 +65,8 @@ void InfoWidget::localeChanged(QLocale locale) languageName->setText(QLocale::languageToString(locale.language())); nativeLanguageName->setText(locale.nativeLanguageName()); scriptName->setText(QLocale::scriptToString(locale.script())); - countryName->setText(QLocale::countryToString(locale.country())); - nativeCountryName->setText(locale.nativeCountryName()); + territoryName->setText(QLocale::territoryToString(locale.territory())); + nativeTerritoryName->setText(locale.nativeTerritoryName()); } void InfoWidget::addItem(const QString &label, QWidget *w) diff --git a/tests/manual/qlocale/info.h b/tests/manual/qlocale/info.h index 1003f84c4f..a477afdb55 100644 --- a/tests/manual/qlocale/info.h +++ b/tests/manual/qlocale/info.h @@ -55,8 +55,8 @@ private: QLineEdit *languageName; QLineEdit *nativeLanguageName; QLineEdit *scriptName; - QLineEdit *countryName; - QLineEdit *nativeCountryName; + QLineEdit *territoryName; + QLineEdit *nativeTerritoryName; private slots: void localeChanged(QLocale locale); diff --git a/tests/manual/qlocale/languages.cpp b/tests/manual/qlocale/languages.cpp index 6a750b9f7b..e3bd8a68f2 100644 --- a/tests/manual/qlocale/languages.cpp +++ b/tests/manual/qlocale/languages.cpp @@ -53,7 +53,7 @@ void LanguagesWidget::localeChanged(QLocale locale) QLocale l(lang); if (l.language() != QLocale::C) { QString language = QLocale::languageToString(l.language()); - QString country = QLocale::countryToString(l.country()); + QString country = QLocale::territoryToString(l.territory()); QString tooltip = QString(QLatin1String("%1: %2/%3")).arg(l.name(), language, country); item->setToolTip(tooltip); } diff --git a/tests/manual/qlocale/window.cpp b/tests/manual/qlocale/window.cpp index 059192492c..b222fcbfd8 100644 --- a/tests/manual/qlocale/window.cpp +++ b/tests/manual/qlocale/window.cpp @@ -41,7 +41,7 @@ Window::Window() localeCombo->addItem("System", QLocale::system()); - QList<QLocale> locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry); + QList<QLocale> locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyTerritory); foreach (const QLocale &locale, locales) { QString label = QLocale::languageToString(locale.language()); label += QLatin1Char('/'); @@ -49,7 +49,7 @@ Window::Window() label += QLocale::scriptToString(locale.script()); label += QLatin1Char('/'); } - label += QLocale::countryToString(locale.country()); + label += QLocale::territoryToString(locale.territory()); localeCombo->addItem(label, locale); } @@ -103,11 +103,11 @@ void Window::systemLocaleChanged() QLocale l = QLocale::system(); QString lang = QLocale::languageToString(l.language()); QString script = QLocale::scriptToString(l.script()); - QString country = QLocale::countryToString(l.country()); + QString territory = QLocale::territoryToString(l.territory()); if (l.script() != QLocale::AnyScript) - localeCombo->setItemText(0, QString("System: %1-%2-%3").arg(lang, script, country)); + localeCombo->setItemText(0, QString("System: %1-%2-%3").arg(lang, script, territory)); else - localeCombo->setItemText(0, QString("System: %1-%2").arg(lang, country)); + localeCombo->setItemText(0, QString("System: %1-%2").arg(lang, territory)); emit localeChanged(0); } |