Merge pull request #346 from Aireil/fix_ui_language

fix: UiLanguage null when no override
This commit is contained in:
goaaats 2021-05-01 00:03:04 +02:00 committed by GitHub
commit f635a1712b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
using System;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
@ -50,7 +51,19 @@ namespace Dalamud.Plugin
this.configs = configs;
this.Sanitizer = new Sanitizer(this.Data.Language);
this.UiLanguage = this.dalamud.Configuration.LanguageOverride;
if (this.dalamud.Configuration.LanguageOverride != null)
{
this.UiLanguage = this.dalamud.Configuration.LanguageOverride;
}
else
{
var currentUiLang = CultureInfo.CurrentUICulture;
if (Localization.ApplicableLangCodes.Any(x => currentUiLang.TwoLetterISOLanguageName == x))
this.UiLanguage = currentUiLang.TwoLetterISOLanguageName;
else
this.UiLanguage = "en";
}
dalamud.LocalizationManager.OnLocalizationChanged += this.OnLocalizationChanged;
}