From 9bd80ee39ff8bd83fda622a5f1dad69c5fb8234d Mon Sep 17 00:00:00 2001 From: KazWolfe Date: Mon, 25 Mar 2024 04:04:49 -0700 Subject: [PATCH] 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 --- .../Settings/Widgets/LanguageChooserSettingsEntry.cs | 12 ++++++------ Dalamud/Localization.cs | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs index c8cc1f42c..2dd7cc6d0 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs @@ -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; } } diff --git a/Dalamud/Localization.cs b/Dalamud/Localization.cs index a9b0cf93d..7b2ac62e7 100644 --- a/Dalamud/Localization.cs +++ b/Dalamud/Localization.cs @@ -70,14 +70,15 @@ public class Localization : IServiceType public CultureInfo DalamudLanguageCultureInfo { get; private set; } /// - /// Gets an instance of that corresponds to . + /// Gets an instance of that corresponds to a Dalamud . /// /// The language code which should be in . /// The corresponding instance of . public static CultureInfo GetCultureInfoFromLangCode(string langCode) => CultureInfo.GetCultureInfo(langCode switch { - "tw" => "zh-tw", + "tw" => "zh-hant", + "zh" => "zh-hans", _ => langCode, });