summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qlocale_p.h
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-04-29 12:33:55 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2019-10-04 15:16:15 +0200
commit0118e2e9151ae3e1e1cd72f24e8c129eaa69dc4f (patch)
tree39551fae04969f7c9bc81bbacb4adc0b7f2e8906 /src/corelib/text/qlocale_p.h
parente46a0501d65e6f84e4c7358f48aab154e2d32598 (diff)
Include likely-adjusted uiLanguages for the system locale
QLocale::uiLanguages() on the system locale uses whatever the system locale's query(QSystemLocale::UILanguages,...) returns. On Android, this is just a list of locales. However, for non-system locales, we also include some results of removing likely sub-tags from the locale name, where equivalent. Thus zh-CN would also get zh and zh-Hans-CN added to it; however, if the system locale is zh-Hans-CN, the shorter forms are omitted. So post-process the system locale list in the same way, albeit tweaked to avoid duplicates and rearranged so that we can insert likely-adjusted entries between what they adjust and what followed it. Added QLocalePrivate::rawName() in the process, since it looks likely to be useful in other contexts (and I needed its value): it just joins such tags as are non-Any. This, however, uses QByteArrayList, so added that (it's small) to the bootstrap library and qmake. This follows up on commit 8796e3016fae1672e727e2fa4e48f671a0c667ba. [ChangeLog][QtCore][QLocale] The system locale's UI languages list now includes, as for that of an ordinary locale, the results of adding likely sub-tags from each locale name, and of removing some, where this doesn't change which locale is specified. This gives searches for translation files a better chance of finding a suitable file. Fixes: QTBUG-75413 Change-Id: Iaafd79aac6a0fdd5f44aed16e445e84a2267c9da Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qlocale_p.h')
-rw-r--r--src/corelib/text/qlocale_p.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h
index 5ebed9b385..edee3a89c7 100644
--- a/src/corelib/text/qlocale_p.h
+++ b/src/corelib/text/qlocale_p.h
@@ -359,6 +359,7 @@ public:
quint16 countryId() const { return m_data->m_country_id; }
QByteArray bcp47Name(char separator = '-') const;
+ QByteArray rawName(char separator = '-') const;
inline QLatin1String languageCode() const { return languageToCode(QLocale::Language(m_data->m_language_id)); }
inline QLatin1String scriptCode() const { return scriptToCode(QLocale::Script(m_data->m_script_id)); }