feat(i18n): add Korean locale
This commit is contained in:
1 parent
b4efcebd78
commit
9e5dfa3396
7 files changed
+6304
-3
No files matched your search
@@ -6,6 +6,7 @@ import en from "@/i18n/locales/en";
|
||||
import es from "@/i18n/locales/es";
|
||||
import it from "@/i18n/locales/it";
|
||||
import ja from "@/i18n/locales/ja";
|
||||
import ko from "@/i18n/locales/ko";
|
||||
import ptBR from "@/i18n/locales/pt-BR";
|
||||
import zhCN from "@/i18n/locales/zh-CN";
|
||||
import zhTW from "@/i18n/locales/zh-TW";
|
||||
@@ -15,6 +16,7 @@ const LOCALES = {
|
||||
es,
|
||||
it,
|
||||
ja,
|
||||
ko,
|
||||
"pt-BR": ptBR,
|
||||
"zh-CN": zhCN,
|
||||
"zh-TW": zhTW,
|
||||
|
||||
@@ -4,6 +4,7 @@ import en from "@/i18n/locales/en";
|
||||
import es from "@/i18n/locales/es";
|
||||
import it from "@/i18n/locales/it";
|
||||
import ja from "@/i18n/locales/ja";
|
||||
import ko from "@/i18n/locales/ko";
|
||||
import ptBR from "@/i18n/locales/pt-BR";
|
||||
import zhCN from "@/i18n/locales/zh-CN";
|
||||
import zhTW from "@/i18n/locales/zh-TW";
|
||||
@@ -20,6 +21,7 @@ describe("cached result messages", () => {
|
||||
["Spanish", es],
|
||||
["Italian", it],
|
||||
["Japanese", ja],
|
||||
["Korean", ko],
|
||||
["Brazilian Portuguese", ptBR],
|
||||
["Simplified Chinese", zhCN],
|
||||
["Traditional Chinese", zhTW],
|
||||
|
||||
@@ -3,6 +3,7 @@ import en from "@/i18n/locales/en";
|
||||
import es from "@/i18n/locales/es";
|
||||
import it from "@/i18n/locales/it";
|
||||
import ja from "@/i18n/locales/ja";
|
||||
import ko from "@/i18n/locales/ko";
|
||||
import ptBR from "@/i18n/locales/pt-BR";
|
||||
import zhCN from "@/i18n/locales/zh-CN";
|
||||
import zhTW from "@/i18n/locales/zh-TW";
|
||||
@@ -18,6 +19,7 @@ describe("SQLite rebuild notice", () => {
|
||||
["Spanish", es],
|
||||
["Italian", it],
|
||||
["Japanese", ja],
|
||||
["Korean", ko],
|
||||
["Brazilian Portuguese", ptBR],
|
||||
["Simplified Chinese", zhCN],
|
||||
["Traditional Chinese", zhTW],
|
||||
|
||||
@@ -3,20 +3,21 @@ import en from "./locales/en";
|
||||
import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage";
|
||||
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
||||
|
||||
export type Locale = "en" | "es" | "it" | "ja" | "pt-BR" | "zh-CN" | "zh-TW";
|
||||
export type Locale = "en" | "es" | "it" | "ja" | "ko" | "pt-BR" | "zh-CN" | "zh-TW";
|
||||
type LocaleMessages = Record<string, unknown>;
|
||||
type I18nGlobal = {
|
||||
locale: { value: Locale };
|
||||
setLocaleMessage: (locale: Locale, messages: LocaleMessages) => void;
|
||||
};
|
||||
|
||||
const supportedLocales: Locale[] = ["en", "es", "it", "ja", "pt-BR", "zh-CN", "zh-TW"];
|
||||
const supportedLocales: Locale[] = ["en", "es", "it", "ja", "ko", "pt-BR", "zh-CN", "zh-TW"];
|
||||
const defaultLocale: Locale = "en";
|
||||
const loadedLocales = new Set<Locale>([defaultLocale]);
|
||||
const localeLoaders: Record<Exclude<Locale, "en">, () => Promise<{ default: LocaleMessages }>> = {
|
||||
es: () => import("./locales/es"),
|
||||
it: () => import("./locales/it"),
|
||||
ja: () => import("./locales/ja"),
|
||||
ko: () => import("./locales/ko"),
|
||||
"pt-BR": () => import("./locales/pt-BR"),
|
||||
"zh-CN": () => import("./locales/zh-CN"),
|
||||
"zh-TW": () => import("./locales/zh-TW"),
|
||||
@@ -42,6 +43,7 @@ export function localeFromLanguageTag(value: string | null | undefined): Locale
|
||||
if (normalized === "es" || normalized.startsWith("es-")) return "es";
|
||||
if (normalized === "it" || normalized.startsWith("it-")) return "it";
|
||||
if (normalized === "ja" || normalized.startsWith("ja-")) return "ja";
|
||||
if (normalized === "ko" || normalized.startsWith("ko-")) return "ko";
|
||||
if (normalized === "pt" || normalized.startsWith("pt-")) return "pt-BR";
|
||||
return null;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -5,6 +5,7 @@ export const LOCALE_OPTIONS: { value: Locale; flag: string; label: string }[] =
|
||||
{ value: "es", flag: "🇪🇸", label: "Español" },
|
||||
{ value: "it", flag: "🇮🇹", label: "Italiano" },
|
||||
{ value: "ja", flag: "🇯🇵", label: "日本語" },
|
||||
{ value: "ko", flag: "🇰🇷", label: "한국어" },
|
||||
{ value: "pt-BR", flag: "🇧🇷", label: "Português" },
|
||||
{ value: "zh-CN", flag: "🇨🇳", label: "简体中文" },
|
||||
{ value: "zh-TW", flag: "繁", label: "繁體中文" },
|
||||
|
||||
Reference in new issue
Block a user