Prevent NPE, load Korean font if it exists (#802)

Co-authored-by: goaaats <goatsdev@protonmail.com>
This commit is contained in:
kizer 2022-04-23 23:42:44 +09:00 committed by GitHub
parent 0b6417fd7c
commit 2a36122c2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 30 deletions

View file

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using Dalamud.Game.Text;
using Dalamud.Interface.GameFonts;
using Dalamud.Interface.Style;
@ -311,6 +312,37 @@ namespace Dalamud.Configuration.Internal
/// </summary>
public bool IsMbCollect { get; set; } = true;
/// <summary>
/// Gets the ISO 639-1 two-letter code for the language of the effective Dalamud display language.
/// </summary>
public string EffectiveLanguage
{
get
{
var languages = Localization.ApplicableLangCodes.Prepend("en").ToArray();
try
{
if (string.IsNullOrEmpty(this.LanguageOverride))
{
var currentUiLang = CultureInfo.CurrentUICulture;
if (Localization.ApplicableLangCodes.Any(x => currentUiLang.TwoLetterISOLanguageName == x))
return currentUiLang.TwoLetterISOLanguageName;
else
return languages[0];
}
else
{
return this.LanguageOverride;
}
}
catch (Exception)
{
return languages[0];
}
}
}
/// <summary>
/// Gets or sets a value indicating whether or not to show info on dev bar.
/// </summary>