From 0e2c40644f12d620d483a95bee63c76d1d096530 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 10 Feb 2023 18:15:53 -0800 Subject: [PATCH] better hack --- QSB/Localization/QSBLocalization.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/QSB/Localization/QSBLocalization.cs b/QSB/Localization/QSBLocalization.cs index a81af601..70a6d918 100644 --- a/QSB/Localization/QSBLocalization.cs +++ b/QSB/Localization/QSBLocalization.cs @@ -43,8 +43,21 @@ public static class QSBLocalization return; } + // just use the system language until the profile is loaded and does SetLanguage // hack to stop things from breaking - Current = _translations[0]; + { + var language = TextTranslation.Get().GetSystemLanguage(); + DebugLog.DebugWrite($"Language changed to {language}"); + var newTranslation = _translations.FirstOrDefault(x => x.Language == language); + + if (newTranslation == default) + { + DebugLog.ToConsole($"Error - Could not find translation for language {language}! Defaulting to English."); + newTranslation = _translations.First(x => x.Language == TextTranslation.Language.ENGLISH); + } + + Current = newTranslation; + } TextTranslation.Get().OnLanguageChanged += OnLanguageChanged; }