diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/Locales.java b/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/Locales.java index 6f5309d3e..868371dce 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/Locales.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/Locales.java @@ -39,16 +39,6 @@ public final class Locales { */ public static final SupportedLocale EN = new SupportedLocale(Locale.ROOT); - /** - * Traditional Chinese - */ - public static final SupportedLocale ZH = new SupportedLocale(Locale.TRADITIONAL_CHINESE); - - /** - * Simplified Chinese - */ - public static final SupportedLocale ZH_CN = new SupportedLocale(Locale.SIMPLIFIED_CHINESE); - /** * Spanish */ @@ -64,23 +54,33 @@ public final class Locales { */ public static final SupportedLocale JA = new SupportedLocale(Locale.JAPANESE); - public static final List LOCALES = Lang.immutableListOf(DEFAULT, EN, ZH_CN, ZH, ES, RU, JA); + /** + * Traditional Chinese + */ + public static final SupportedLocale ZH = new SupportedLocale(Locale.TRADITIONAL_CHINESE); + + /** + * Simplified Chinese + */ + public static final SupportedLocale ZH_CN = new SupportedLocale(Locale.SIMPLIFIED_CHINESE); + + public static final List LOCALES = Lang.immutableListOf(DEFAULT, EN, ES, JA, RU, ZH_CN, ZH); public static SupportedLocale getLocaleByName(String name) { if (name == null) return DEFAULT; switch (name.toLowerCase(Locale.ROOT)) { case "en": return EN; + case "es": + return ES; + case "ja": + return JA; + case "ru": + return RU; case "zh": return ZH; case "zh_cn": return ZH_CN; - case "es": - return ES; - case "ru": - return RU; - case "ja": - return JA; default: return DEFAULT; } @@ -88,11 +88,11 @@ public final class Locales { public static String getNameByLocale(SupportedLocale locale) { if (locale == EN) return "en"; - else if (locale == ZH) return "zh"; - else if (locale == ZH_CN) return "zh_CN"; else if (locale == ES) return "es"; else if (locale == RU) return "ru"; else if (locale == JA) return "ja"; + else if (locale == ZH) return "zh"; + else if (locale == ZH_CN) return "zh_CN"; else if (locale == DEFAULT) return "def"; else throw new IllegalArgumentException("Unknown locale: " + locale); }