summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2018-03-10 12:52:02 +0100
committerJosJuice <josjuice@gmail.com>2018-03-11 22:27:17 +0100
commit4b85f7fe79d7a57a6dfb53dcad3410df9d8a5c57 (patch)
treeb4d547b06bdbfbf2c00e00621236c894c384ca71 /Source/Core
parent63838c013bde06ed13bfc1b5e24c53594934f641 (diff)
Qt2 translation: Don't place "zh_CN" and "zh_TW" after "zh"
The least specific language code should be tried last.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt2/Translation.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Core/DolphinQt2/Translation.cpp b/Source/Core/DolphinQt2/Translation.cpp
index b73701c555..8b6a6615d0 100644
--- a/Source/Core/DolphinQt2/Translation.cpp
+++ b/Source/Core/DolphinQt2/Translation.cpp
@@ -237,10 +237,12 @@ QStringList FindPossibleLanguageCodes(const QString& exact_language_code)
// On macOS, Chinese (Simplified) and Chinese (Traditional) are represented as zh-Hans and
// zh-Hant, but on Linux they're represented as zh-CN and zh-TW. Qt should probably include the
// script subtags on Linux, but it doesn't.
- if (possible_language_codes.contains(QStringLiteral("zh_Hans")))
- possible_language_codes << QStringLiteral("zh_CN");
- if (possible_language_codes.contains(QStringLiteral("zh_Hant")))
- possible_language_codes << QStringLiteral("zh_TW");
+ const int hans_index = possible_language_codes.indexOf(QStringLiteral("zh_Hans"));
+ if (hans_index != -1)
+ possible_language_codes.insert(hans_index + 1, QStringLiteral("zh_CN"));
+ const int hant_index = possible_language_codes.indexOf(QStringLiteral("zh_Hant"));
+ if (hant_index != -1)
+ possible_language_codes.insert(hant_index + 1, QStringLiteral("zh_TW"));
return possible_language_codes;
}