diff options
-rw-r--r-- | src/corelib/text/qlocale.cpp | 4 | ||||
-rw-r--r-- | src/corelib/text/qlocale.qdoc | 18 | ||||
-rw-r--r-- | src/corelib/text/qlocale_mac.mm | 2 | ||||
-rw-r--r-- | src/corelib/text/qlocale_p.h | 6 | ||||
-rw-r--r-- | src/corelib/text/qlocale_unix.cpp | 2 | ||||
-rw-r--r-- | src/corelib/text/qlocale_win.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidsystemlocale.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidsystemlocale.h | 2 | ||||
-rw-r--r-- | tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 2 |
9 files changed, 24 insertions, 20 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index ed1f0e818d..ba64ffd761 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -707,7 +707,7 @@ static void updateSystemPrivate() sys_locale->query(QSystemLocale::LocaleChanged); // Populate global with fallback as basis: - globalLocaleData = locale_data[sys_locale->fallbackUiLocaleIndex()]; + globalLocaleData = locale_data[sys_locale->fallbackLocaleIndex()]; QVariant res = sys_locale->query(QSystemLocale::LanguageId); if (!res.isNull()) { @@ -4240,7 +4240,7 @@ QStringList QLocale::uiLanguages() const for (const auto &entry : uiLanguages) locales.append(QLocale(entry)); if (locales.isEmpty()) - locales.append(systemLocale()->fallbackUiLocale()); + locales.append(systemLocale()->fallbackLocale()); } else #endif { diff --git a/src/corelib/text/qlocale.qdoc b/src/corelib/text/qlocale.qdoc index b20fce7c6d..200f6db292 100644 --- a/src/corelib/text/qlocale.qdoc +++ b/src/corelib/text/qlocale.qdoc @@ -1113,13 +1113,6 @@ */ /*! - \fn QLocale QSystemLocale::fallbackUiLocale() const - - \since 4.6 - Returns the fallback locale obtained from the system. -*/ - -/*! \fn QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const Generic query method for locale data. Provides indirection. @@ -1130,6 +1123,17 @@ */ /*! + \fn QLocale QSystemLocale::fallbackLocale() const + + \since 4.6 + + Returns the locale used if the system locale is not able to answer a query. + + Must be a QLocale instance based on the built-in CLDR data, and should + match what the system locale is using as closely as that data supports. +*/ + +/*! \class QSystemLocale::CurrencyToStringArgument \inmodule QtCore diff --git a/src/corelib/text/qlocale_mac.mm b/src/corelib/text/qlocale_mac.mm index 281fedcfab..7a41bdd8c1 100644 --- a/src/corelib/text/qlocale_mac.mm +++ b/src/corelib/text/qlocale_mac.mm @@ -418,7 +418,7 @@ static QVariant macQuoteString(QSystemLocale::QueryType type, QStringView str) #ifndef QT_NO_SYSTEMLOCALE -QLocale QSystemLocale::fallbackUiLocale() const +QLocale QSystemLocale::fallbackLocale() const { return QLocale(getMacLocaleName()); } diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index 2f249e970e..6e4073eaa3 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -127,9 +127,9 @@ public: StandaloneMonthNameShort // QString, in: int }; virtual QVariant query(QueryType type, QVariant in = QVariant()) const; - virtual QLocale fallbackUiLocale() const; - inline uint fallbackUiLocaleIndex() const; + virtual QLocale fallbackLocale() const; + inline uint fallbackLocaleIndex() const; private: QSystemLocale(bool); friend class QSystemLocaleSingleton; @@ -428,7 +428,7 @@ public: }; #ifndef QT_NO_SYSTEMLOCALE -uint QSystemLocale::fallbackUiLocaleIndex() const { return fallbackUiLocale().d->m_index; } +uint QSystemLocale::fallbackLocaleIndex() const { return fallbackLocale().d->m_index; } #endif template <> diff --git a/src/corelib/text/qlocale_unix.cpp b/src/corelib/text/qlocale_unix.cpp index adc73ad19a..2caa6b7799 100644 --- a/src/corelib/text/qlocale_unix.cpp +++ b/src/corelib/text/qlocale_unix.cpp @@ -133,7 +133,7 @@ static bool contradicts(const QString &maybe, const QString &known) return !(maybeId.acceptLanguage(knownId.language_id) && maybeId.acceptScriptCountry(knownId)); } -QLocale QSystemLocale::fallbackUiLocale() const +QLocale QSystemLocale::fallbackLocale() const { // See man 7 locale for precedence - LC_ALL beats LC_MESSAGES beats LANG: QString lang = qEnvironmentVariable("LC_ALL"); diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index f244826c33..bc7c6e1fb6 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -702,7 +702,7 @@ QString QSystemLocalePrivate::winToQtFormat(QStringView sys_fmt) return result; } -QLocale QSystemLocale::fallbackUiLocale() const +QLocale QSystemLocale::fallbackLocale() const { return QLocale(QString::fromLatin1(getWinLocaleName())); } @@ -762,8 +762,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const if (type == LanguageId) return lid.language_id; if (type == ScriptId) - return lid.script_id ? lid.script_id : ushort(fallbackUiLocale().script()); - return lid.country_id ? lid.country_id : ushort(fallbackUiLocale().country()); + return lid.script_id ? lid.script_id : ushort(fallbackLocale().script()); + return lid.country_id ? lid.country_id : ushort(fallbackLocale().country()); } case MeasurementSystem: return d->measurementSystem(); diff --git a/src/plugins/platforms/android/qandroidsystemlocale.cpp b/src/plugins/platforms/android/qandroidsystemlocale.cpp index 45387b53c7..351274a560 100644 --- a/src/plugins/platforms/android/qandroidsystemlocale.cpp +++ b/src/plugins/platforms/android/qandroidsystemlocale.cpp @@ -187,7 +187,7 @@ QVariant QAndroidSystemLocale::query(QueryType type, QVariant in) const return QVariant(); } -QLocale QAndroidSystemLocale::fallbackUiLocale() const +QLocale QAndroidSystemLocale::fallbackLocale() const { QReadLocker locker(&m_lock); return m_locale; diff --git a/src/plugins/platforms/android/qandroidsystemlocale.h b/src/plugins/platforms/android/qandroidsystemlocale.h index bc96d2e8f6..0937f6c134 100644 --- a/src/plugins/platforms/android/qandroidsystemlocale.h +++ b/src/plugins/platforms/android/qandroidsystemlocale.h @@ -51,7 +51,7 @@ public: QAndroidSystemLocale(); QVariant query(QueryType type, QVariant in) const override; - QLocale fallbackUiLocale() const override; + QLocale fallbackLocale() const override; private: void getLocaleFromJava() const; diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 4ed4bd0c11..60cd4a9a16 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -3056,7 +3056,7 @@ public: return QVariant(); } - QLocale fallbackUiLocale() const override + QLocale fallbackLocale() const override { return m_locale; } |