|
|
@@ -10,6 +10,7 @@ import { dict as de } from "@/i18n/de"
|
|
|
import { dict as es } from "@/i18n/es"
|
|
|
import { dict as fr } from "@/i18n/fr"
|
|
|
import { dict as da } from "@/i18n/da"
|
|
|
+import { dict as ja } from "@/i18n/ja"
|
|
|
import { dict as uiEn } from "@opencode-ai/ui/i18n/en"
|
|
|
import { dict as uiZh } from "@opencode-ai/ui/i18n/zh"
|
|
|
import { dict as uiKo } from "@opencode-ai/ui/i18n/ko"
|
|
|
@@ -17,13 +18,14 @@ import { dict as uiDe } from "@opencode-ai/ui/i18n/de"
|
|
|
import { dict as uiEs } from "@opencode-ai/ui/i18n/es"
|
|
|
import { dict as uiFr } from "@opencode-ai/ui/i18n/fr"
|
|
|
import { dict as uiDa } from "@opencode-ai/ui/i18n/da"
|
|
|
+import { dict as uiJa } from "@opencode-ai/ui/i18n/ja"
|
|
|
|
|
|
-export type Locale = "en" | "zh" | "ko" | "de" | "es" | "fr" | "da"
|
|
|
+export type Locale = "en" | "zh" | "ko" | "de" | "es" | "fr" | "da" | "ja"
|
|
|
|
|
|
type RawDictionary = typeof en & typeof uiEn
|
|
|
type Dictionary = i18n.Flatten<RawDictionary>
|
|
|
|
|
|
-const LOCALES: readonly Locale[] = ["en", "zh", "ko", "de", "es", "fr", "da"]
|
|
|
+const LOCALES: readonly Locale[] = ["en", "zh", "ko", "de", "es", "fr", "da", "ja"]
|
|
|
|
|
|
function detectLocale(): Locale {
|
|
|
if (typeof navigator !== "object") return "en"
|
|
|
@@ -37,6 +39,7 @@ function detectLocale(): Locale {
|
|
|
if (language.toLowerCase().startsWith("es")) return "es"
|
|
|
if (language.toLowerCase().startsWith("fr")) return "fr"
|
|
|
if (language.toLowerCase().startsWith("da")) return "da"
|
|
|
+ if (language.toLowerCase().startsWith("ja")) return "ja"
|
|
|
}
|
|
|
|
|
|
return "en"
|
|
|
@@ -59,6 +62,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
|
|
|
if (store.locale === "es") return "es"
|
|
|
if (store.locale === "fr") return "fr"
|
|
|
if (store.locale === "da") return "da"
|
|
|
+ if (store.locale === "ja") return "ja"
|
|
|
return "en"
|
|
|
})
|
|
|
|
|
|
@@ -76,6 +80,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
|
|
|
if (locale() === "es") return { ...base, ...i18n.flatten({ ...es, ...uiEs }) }
|
|
|
if (locale() === "fr") return { ...base, ...i18n.flatten({ ...fr, ...uiFr }) }
|
|
|
if (locale() === "da") return { ...base, ...i18n.flatten({ ...da, ...uiDa }) }
|
|
|
+ if (locale() === "ja") return { ...base, ...i18n.flatten({ ...ja, ...uiJa }) }
|
|
|
return { ...base, ...i18n.flatten({ ...ko, ...uiKo }) }
|
|
|
})
|
|
|
|
|
|
@@ -89,6 +94,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
|
|
|
es: "language.es",
|
|
|
fr: "language.fr",
|
|
|
da: "language.da",
|
|
|
+ ja: "language.ja",
|
|
|
}
|
|
|
|
|
|
const label = (value: Locale) => t(labelKey[value])
|