diff options
| author | NourEldin Osama <[email protected]> | 2026-01-22 10:14:01 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-22 02:14:01 -0600 |
| commit | ba2e35e29c5fd48a112ae566e9e0dbd4562c491a (patch) | |
| tree | 727ed437fbb7de5cb670d7ecfc5f0ead6b36457a /packages/app/src/context | |
| parent | 9afc067152c0e7010a5e22d3c34e53adaf3218d3 (diff) | |
| download | opencode-ba2e35e29c5fd48a112ae566e9e0dbd4562c491a.tar.gz opencode-ba2e35e29c5fd48a112ae566e9e0dbd4562c491a.zip | |
feat(i18n): add Arabic language support (#9947)
Diffstat (limited to 'packages/app/src/context')
| -rw-r--r-- | packages/app/src/context/language.tsx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/app/src/context/language.tsx b/packages/app/src/context/language.tsx index e3cf3c50d..e34e399d8 100644 --- a/packages/app/src/context/language.tsx +++ b/packages/app/src/context/language.tsx @@ -14,6 +14,7 @@ import { dict as da } from "@/i18n/da" import { dict as ja } from "@/i18n/ja" import { dict as pl } from "@/i18n/pl" import { dict as ru } from "@/i18n/ru" +import { dict as ar } from "@/i18n/ar" 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" @@ -25,13 +26,14 @@ import { dict as uiDa } from "@opencode-ai/ui/i18n/da" import { dict as uiJa } from "@opencode-ai/ui/i18n/ja" import { dict as uiPl } from "@opencode-ai/ui/i18n/pl" import { dict as uiRu } from "@opencode-ai/ui/i18n/ru" +import { dict as uiAr } from "@opencode-ai/ui/i18n/ar" -export type Locale = "en" | "zh" | "zht" | "ko" | "de" | "es" | "fr" | "da" | "ja" | "pl" | "ru" +export type Locale = "en" | "zh" | "zht" | "ko" | "de" | "es" | "fr" | "da" | "ja" | "pl" | "ru" | "ar" 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"] +const LOCALES: readonly Locale[] = ["en", "zh", "zht", "ko", "de", "es", "fr", "da", "ja", "pl", "ru", "ar"] function detectLocale(): Locale { if (typeof navigator !== "object") return "en" @@ -51,6 +53,7 @@ function detectLocale(): Locale { if (language.toLowerCase().startsWith("ja")) return "ja" if (language.toLowerCase().startsWith("pl")) return "pl" if (language.toLowerCase().startsWith("ru")) return "ru" + if (language.toLowerCase().startsWith("ar")) return "ar" } return "en" @@ -77,6 +80,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont if (store.locale === "ja") return "ja" if (store.locale === "pl") return "pl" if (store.locale === "ru") return "ru" + if (store.locale === "ar") return "ar" return "en" }) @@ -98,6 +102,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont if (locale() === "ja") return { ...base, ...i18n.flatten({ ...ja, ...uiJa }) } if (locale() === "pl") return { ...base, ...i18n.flatten({ ...pl, ...uiPl }) } if (locale() === "ru") return { ...base, ...i18n.flatten({ ...ru, ...uiRu }) } + if (locale() === "ar") return { ...base, ...i18n.flatten({ ...ar, ...uiAr }) } return { ...base, ...i18n.flatten({ ...ko, ...uiKo }) } }) @@ -115,6 +120,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont ja: "language.ja", pl: "language.pl", ru: "language.ru", + ar: "language.ar", } const label = (value: Locale) => t(labelKey[value]) |
