From 56cd42539652ed264de1a35f847d660555b6fe99 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Mon, 26 Dec 2022 13:59:48 +0000 Subject: [PATCH] Fix switching locale from English The locale code used the `forceLocale = "en"` fallback when the locale was set to English, so switching from English did not actually change the language. --- Source/utils/language.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/utils/language.cpp b/Source/utils/language.cpp index ea6fe279e..472dd7c27 100644 --- a/Source/utils/language.cpp +++ b/Source/utils/language.cpp @@ -361,6 +361,14 @@ void LanguageInitialize() translationKeys = nullptr; translationValues = nullptr; + const std::string lang(GetLanguageCode()); + + if (lang == "en") { + // English does not have a translation file. + GetLocalPluralId = PluralIfNotOne; + return; + } + if (IsSmallFontTall() && !HaveExtraFonts()) { UiErrorOkDialog( "Missing fonts.mpq", @@ -372,8 +380,6 @@ void LanguageInitialize() forceLocale = "en"; } - const std::string lang(GetLanguageCode()); - AssetHandle handle; const uint32_t loadTranslationsStart = SDL_GetTicks();