summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qlocale.h
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2020-12-11 16:40:37 +0100
committerKai Köhne <kai.koehne@qt.io>2021-01-18 15:52:31 +0100
commitf1465c621c11712991fabe5b8b81ccbb6eea4bb9 (patch)
tree638ea8c9f7e1cf9989736db30ad411a67939c815 /src/corelib/text/qlocale.h
parent2d8757f879d8f410319aae41ff902ba5a679d9dd (diff)
QLocale: Allow direct conversion to language, country, and script codes
Currently the codes are only exposed in aggregated form, i.e. through name(), bcp47Name(). There are use cases though where you are only interested in either language, country, or script codes. One example is in Qt Linguist. This patch therefore exposes the static languageToCode(), countryToCode(), scriptToCode() methods that were so far only available in the private API also in the public API. [ChangeLog][QtCore][QLocale] Added static languageToCode(), countryToCode() scriptToCode() methods that convert enum values to the respective ISO code strings. Fixes: QTBUG-39542 Fixes: QTBUG-64942 Change-Id: Ib1d5c3293e2f53245ba4c1fc8159275bcb290080 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/text/qlocale.h')
-rw-r--r--src/corelib/text/qlocale.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/text/qlocale.h b/src/corelib/text/qlocale.h
index 2f9070bdd1..a05196946f 100644
--- a/src/corelib/text/qlocale.h
+++ b/src/corelib/text/qlocale.h
@@ -1067,6 +1067,10 @@ public:
QStringList uiLanguages() const;
+ static QString languageToCode(Language language);
+ static QString countryToCode(Country country);
+ static QString scriptToCode(Script script);
+
static QString languageToString(Language language);
static QString countryToString(Country country);
static QString scriptToString(Script script);