diff --git a/src/G2DataGUI.UI.Common/Locale/LocaleManager.cs b/src/G2DataGUI.UI.Common/Locale/LocaleManager.cs index 5221b0c..b7d31eb 100644 --- a/src/G2DataGUI.UI.Common/Locale/LocaleManager.cs +++ b/src/G2DataGUI.UI.Common/Locale/LocaleManager.cs @@ -23,7 +23,7 @@ private LocaleManager() public void Load() { - string systemLanguageCode = CultureInfo.CurrentCulture.Name.Replace("-", "_"); + string systemLanguageCode = GetSupportedLanguage(); LoadLanguage(systemLanguageCode); LoadDefaultLanguage(); } @@ -36,9 +36,17 @@ public void LoadLanguage(string languageCode) } } - private void LoadDefaultLanguage() => _defaultLocaleStringLists = LoadJsonLanguage(); + private void LoadDefaultLanguage() => _defaultLocaleStringLists = LoadJsonLanguage(); - private Dictionary> LoadJsonLanguage(string languageCode = DefaultLanguageCode) + private string GetSupportedLanguage() + { + string systemLanguage = CultureInfo.CurrentCulture.Name.Replace("-", "_"); + + // Todo: Check if systemLanguage is in supported locales, at the moment it's only en_US. + return DefaultLanguageCode; + } + + private Dictionary> LoadJsonLanguage(string languageCode = DefaultLanguageCode) { Dictionary> localeStringLists = new(); string jsonData = EmbeddedResources.ReadAllText($"G2DataGUI.UI.Common/Assets/Locales/{languageCode}.json");