Change Chinese Language Localization Names (#1749)

* locale name standardize

* change ko back to English

* cn -> zh

* Change Chinese localization mapping

- Maps tw to zh-hant, and zh to zh-hans
- Removes explicit override for tw langcode in UI
- Makes all languages use Windows-provided name and capitalization
- Add note to ko to prevent accidental helpful PRs

---------

Co-authored-by: wozaiha <wozaiha@gmail.com>
This commit is contained in:
KazWolfe 2024-03-25 04:04:49 -07:00 committed by GitHub
parent 3c471575af
commit 9bd80ee39f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
@ -36,14 +36,14 @@ public sealed class LanguageChooserSettingsEntry : SettingsEntry
switch (language)
{
case "ko":
// We're intentionally keeping this in English, as the Korean fonts are not loaded in unless
// the language is already Korean or other preconditions are met. It's excessive to load a font
// for two characters.
locLanguagesList.Add("Korean");
break;
case "tw":
locLanguagesList.Add("中華民國國語");
break;
default:
string locLanguage = CultureInfo.GetCultureInfo(language).NativeName;
locLanguagesList.Add(char.ToUpper(locLanguage[0]) + locLanguage[1..]);
var loc = Localization.GetCultureInfoFromLangCode(language);
locLanguagesList.Add(loc.TextInfo.ToTitleCase(loc.NativeName));
break;
}
}

View file

@ -70,14 +70,15 @@ public class Localization : IServiceType
public CultureInfo DalamudLanguageCultureInfo { get; private set; }
/// <summary>
/// Gets an instance of <see cref="CultureInfo"/> that corresponds to <paramref name="langCode"/>.
/// Gets an instance of <see cref="CultureInfo"/> that corresponds to a Dalamud <paramref name="langCode"/>.
/// </summary>
/// <param name="langCode">The language code which should be in <see cref="ApplicableLangCodes"/>.</param>
/// <returns>The corresponding instance of <see cref="CultureInfo"/>.</returns>
public static CultureInfo GetCultureInfoFromLangCode(string langCode) =>
CultureInfo.GetCultureInfo(langCode switch
{
"tw" => "zh-tw",
"tw" => "zh-hant",
"zh" => "zh-hans",
_ => langCode,
});