diff options
author | Jamie Mansfield <jmansfield@cadixdev.org> | 2021-04-08 18:05:44 +0100 |
---|---|---|
committer | Jamie Mansfield <jmansfield@cadixdev.org> | 2021-04-08 18:53:16 +0100 |
commit | 64617201b029c0df72974e91d3314b5ee0e80971 (patch) | |
tree | f12fa801e72db4f1ee269226ee4c94dd4ee0ae66 /api/logic/translations/TranslationsModel.cpp | |
parent | d6dc22d57c33497b5908abaf53770cde1773c0a7 (diff) | |
download | PrismLauncher-64617201b029c0df72974e91d3314b5ee0e80971.tar.gz PrismLauncher-64617201b029c0df72974e91d3314b5ee0e80971.tar.bz2 PrismLauncher-64617201b029c0df72974e91d3314b5ee0e80971.zip |
GH-3334 Show English variants correctly
This will no longer show 'American English' with the statistics of
'British English', yet show the correct translations - and will now
display 'British English'.
Diffstat (limited to 'api/logic/translations/TranslationsModel.cpp')
-rw-r--r-- | api/logic/translations/TranslationsModel.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/api/logic/translations/TranslationsModel.cpp b/api/logic/translations/TranslationsModel.cpp index adb3fa98..401b64d4 100644 --- a/api/logic/translations/TranslationsModel.cpp +++ b/api/logic/translations/TranslationsModel.cpp @@ -15,7 +15,19 @@ #include "POTranslator.h" -const static QLatin1Literal defaultLangCode("en"); +const static QLatin1Literal defaultLangCode("en_US"); + +static QLocale getLocaleFromKey(const QString &key) { + if(key == "pt") { + return QLocale("pt_PT"); + } + else if (key == "en") { + return QLocale("en_GB"); + } + else { + return QLocale(key); + } +} enum class FileType { @@ -33,12 +45,7 @@ struct Language Language(const QString & _key) { key = _key; - if(key == "pt") { - locale = QLocale("pt_PT"); - } - else { - locale = QLocale(key); - } + locale = getLocaleFromKey(key); updated = (key == defaultLangCode); } @@ -452,7 +459,7 @@ bool TranslationsModel::selectLanguage(QString key) * In a multithreaded application, the default locale should be set at application startup, before any non-GUI threads are created. * This function is not reentrant. */ - QLocale locale(langCode); + QLocale locale = getLocaleFromKey(langCode); QLocale::setDefault(locale); // if it's the default UI language, finish |