mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Fix language selector throwing a exception, use native name for Taiwan (#1634)
The language selector has only been showing language codes and not the
actual language names since dd0159ae5a
because "tw" (Taiwan Mandarin) was added and it's not supported by
CultureInfo.
This adds a specific check like the language code to work around this
and stop throwing exceptions. Also converts to a switch so it looks a
bit nicer.
This commit is contained in:
parent
65265b678e
commit
1d32e8fe45
1 changed files with 11 additions and 8 deletions
|
|
@ -31,17 +31,20 @@ public sealed class LanguageChooserSettingsEntry : SettingsEntry
|
|||
try
|
||||
{
|
||||
var locLanguagesList = new List<string>();
|
||||
string locLanguage;
|
||||
foreach (var language in this.languages)
|
||||
{
|
||||
if (language != "ko")
|
||||
{
|
||||
locLanguage = CultureInfo.GetCultureInfo(language).NativeName;
|
||||
locLanguagesList.Add(char.ToUpper(locLanguage[0]) + locLanguage[1..]);
|
||||
}
|
||||
else
|
||||
switch (language)
|
||||
{
|
||||
case "ko":
|
||||
locLanguagesList.Add("Korean");
|
||||
break;
|
||||
case "tw":
|
||||
locLanguagesList.Add("中華民國國語");
|
||||
break;
|
||||
default:
|
||||
string locLanguage = CultureInfo.GetCultureInfo(language).NativeName;
|
||||
locLanguagesList.Add(char.ToUpper(locLanguage[0]) + locLanguage[1..]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue