summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context
diff options
context:
space:
mode:
authorNattawee Phantawong <[email protected]>2026-01-28 21:10:50 +0700
committerGitHub <[email protected]>2026-01-28 08:10:50 -0600
commit775d28802720121341c0228596496aa8e25e7189 (patch)
tree144f475ed1a5e1bb560a9b67a3a43217bcd6b272 /packages/app/src/context
parentbc4968abbb736a5a736253bdb31fe80cc8d2cd67 (diff)
downloadopencode-775d28802720121341c0228596496aa8e25e7189.tar.gz
opencode-775d28802720121341c0228596496aa8e25e7189.zip
feat(i18n): add th locale support (#10809)
Diffstat (limited to 'packages/app/src/context')
-rw-r--r--packages/app/src/context/language.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/app/src/context/language.tsx b/packages/app/src/context/language.tsx
index da10e4773..b83800ded 100644
--- a/packages/app/src/context/language.tsx
+++ b/packages/app/src/context/language.tsx
@@ -17,6 +17,7 @@ import { dict as ru } from "@/i18n/ru"
import { dict as ar } from "@/i18n/ar"
import { dict as no } from "@/i18n/no"
import { dict as br } from "@/i18n/br"
+import { dict as th } from "@/i18n/th"
import { dict as uiEn } from "@opencode-ai/ui/i18n/en"
import { dict as uiZh } from "@opencode-ai/ui/i18n/zh"
import { dict as uiZht } from "@opencode-ai/ui/i18n/zht"
@@ -31,13 +32,14 @@ import { dict as uiRu } from "@opencode-ai/ui/i18n/ru"
import { dict as uiAr } from "@opencode-ai/ui/i18n/ar"
import { dict as uiNo } from "@opencode-ai/ui/i18n/no"
import { dict as uiBr } from "@opencode-ai/ui/i18n/br"
+import { dict as uiTh } from "@opencode-ai/ui/i18n/th"
-export type Locale = "en" | "zh" | "zht" | "ko" | "de" | "es" | "fr" | "da" | "ja" | "pl" | "ru" | "ar" | "no" | "br"
+export type Locale = "en" | "zh" | "zht" | "ko" | "de" | "es" | "fr" | "da" | "ja" | "pl" | "ru" | "ar" | "no" | "br" | "th"
type RawDictionary = typeof en & typeof uiEn
type Dictionary = i18n.Flatten<RawDictionary>
-const LOCALES: readonly Locale[] = ["en", "zh", "zht", "ko", "de", "es", "fr", "da", "ja", "pl", "ru", "ar", "no", "br"]
+const LOCALES: readonly Locale[] = ["en", "zh", "zht", "ko", "de", "es", "fr", "da", "ja", "pl", "ru", "ar", "no", "br", "th"]
function detectLocale(): Locale {
if (typeof navigator !== "object") return "en"
@@ -65,6 +67,7 @@ function detectLocale(): Locale {
)
return "no"
if (language.toLowerCase().startsWith("pt")) return "br"
+ if (language.toLowerCase().startsWith("th")) return "th"
}
return "en"
@@ -94,6 +97,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
if (store.locale === "ar") return "ar"
if (store.locale === "no") return "no"
if (store.locale === "br") return "br"
+ if (store.locale === "th") return "th"
return "en"
})
@@ -118,6 +122,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
if (locale() === "ar") return { ...base, ...i18n.flatten({ ...ar, ...uiAr }) }
if (locale() === "no") return { ...base, ...i18n.flatten({ ...no, ...uiNo }) }
if (locale() === "br") return { ...base, ...i18n.flatten({ ...br, ...uiBr }) }
+ if (locale() === "th") return { ...base, ...i18n.flatten({ ...th, ...uiTh }) }
return { ...base, ...i18n.flatten({ ...ko, ...uiKo }) }
})
@@ -138,6 +143,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
ar: "language.ar",
no: "language.no",
br: "language.br",
+ th: "language.th",
}
const label = (value: Locale) => t(labelKey[value])