Skip to content

Commit db3bc06

Browse files
MusiCode1claude
andcommitted
feat(i18n): add Hebrew translation
Add full Hebrew (he) locale support for the web app: - 946 app translation keys (packages/app/src/i18n/he.ts) - 162 UI translation keys (packages/ui/src/i18n/he.ts) - Register Hebrew in language system with RTL document direction - Add locale matcher and parity test coverage Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 405b0b0 commit db3bc06

5 files changed

Lines changed: 1118 additions & 1 deletion

File tree

packages/app/src/context/language.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type Locale =
2424
| "th"
2525
| "bs"
2626
| "tr"
27+
| "he"
2728

2829
type RawDictionary = typeof en & typeof uiEn
2930
type Dictionary = i18n.Flatten<RawDictionary>
@@ -51,6 +52,7 @@ const LOCALES: readonly Locale[] = [
5152
"br",
5253
"th",
5354
"tr",
55+
"he",
5456
]
5557

5658
const INTL: Record<Locale, string> = {
@@ -71,6 +73,7 @@ const INTL: Record<Locale, string> = {
7173
th: "th",
7274
bs: "bs",
7375
tr: "tr",
76+
he: "he",
7477
}
7578

7679
const LABEL_KEY: Record<Locale, keyof Dictionary> = {
@@ -91,6 +94,7 @@ const LABEL_KEY: Record<Locale, keyof Dictionary> = {
9194
th: "language.th",
9295
bs: "language.bs",
9396
tr: "language.tr",
97+
he: "language.he",
9498
}
9599

96100
const base = i18n.flatten({ ...en, ...uiEn })
@@ -116,6 +120,7 @@ const loaders: Record<Exclude<Locale, "en">, () => Promise<Dictionary>> = {
116120
th: () => merge(import("@/i18n/th"), import("@opencode-ai/ui/i18n/th")),
117121
bs: () => merge(import("@/i18n/bs"), import("@opencode-ai/ui/i18n/bs")),
118122
tr: () => merge(import("@/i18n/tr"), import("@opencode-ai/ui/i18n/tr")),
123+
he: () => merge(import("@/i18n/he"), import("@opencode-ai/ui/i18n/he")),
119124
}
120125

121126
function loadDict(locale: Locale) {
@@ -154,6 +159,7 @@ const localeMatchers: Array<{ locale: Locale; match: (language: string) => boole
154159
{ locale: "th", match: (language) => language.startsWith("th") },
155160
{ locale: "bs", match: (language) => language.startsWith("bs") },
156161
{ locale: "tr", match: (language) => language.startsWith("tr") },
162+
{ locale: "he", match: (language) => language.startsWith("he") },
157163
]
158164

159165
function detectLocale(): Locale {
@@ -218,6 +224,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
218224
createEffect(() => {
219225
if (typeof document !== "object") return
220226
document.documentElement.lang = locale()
227+
document.documentElement.dir = locale() === "ar" || locale() === "he" ? "rtl" : "ltr"
221228
document.cookie = cookie(locale())
222229
})
223230

packages/app/src/i18n/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ export const dict = {
416416
"language.bs": "Bosanski",
417417
"language.th": "ไทย",
418418
"language.tr": "Türkçe",
419+
"language.he": "עברית",
419420

420421
"toast.language.title": "Language",
421422
"toast.language.description": "Switched to {{language}}",

0 commit comments

Comments
 (0)