GeezerVison is showing github.com — feat(app): add Turkish (tr) locale for app and ui packages (#15278) · dotneB/opencode@a325c9a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/app/src/context/language.tsx +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,6 +19,7 @@ import { dict as no } from "@/i18n/no" | 19 | 19 | import { dict as br } from "@/i18n/br" | 20 | 20 | import { dict as th } from "@/i18n/th" | 21 | 21 | import { dict as bs } from "@/i18n/bs" | | 22 | +import { dict as tr } from "@/i18n/tr" | 22 | 23 | import { dict as uiEn } from "@opencode-ai/ui/i18n/en" | 23 | 24 | import { dict as uiZh } from "@opencode-ai/ui/i18n/zh" | 24 | 25 | import { dict as uiZht } from "@opencode-ai/ui/i18n/zht" | @@ -35,6 +36,7 @@ import { dict as uiNo } from "@opencode-ai/ui/i18n/no" | 35 | 36 | import { dict as uiBr } from "@opencode-ai/ui/i18n/br" | 36 | 37 | import { dict as uiTh } from "@opencode-ai/ui/i18n/th" | 37 | 38 | import { dict as uiBs } from "@opencode-ai/ui/i18n/bs" | | 39 | +import { dict as uiTr } from "@opencode-ai/ui/i18n/tr" | 38 | 40 |
| 39 | 41 | export type Locale = | 40 | 42 | | "en" | @@ -53,6 +55,7 @@ export type Locale = | 53 | 55 | | "br" | 54 | 56 | | "th" | 55 | 57 | | "bs" | | 58 | + | "tr" | 56 | 59 |
| 57 | 60 | type RawDictionary = typeof en & typeof uiEn | 58 | 61 | type Dictionary = i18n.Flatten<RawDictionary> | @@ -78,6 +81,7 @@ const LOCALES: readonly Locale[] = [ | 78 | 81 | "no", | 79 | 82 | "br", | 80 | 83 | "th", | | 84 | + "tr", | 81 | 85 | ] | 82 | 86 |
| 83 | 87 | const LABEL_KEY: Record<Locale, keyof Dictionary> = { | @@ -97,6 +101,7 @@ const LABEL_KEY: Record<Locale, keyof Dictionary> = { | 97 | 101 | br: "language.br", | 98 | 102 | th: "language.th", | 99 | 103 | bs: "language.bs", | | 104 | + tr: "language.tr", | 100 | 105 | } | 101 | 106 |
| 102 | 107 | const base = i18n.flatten({ ...en, ...uiEn }) | @@ -117,6 +122,7 @@ const DICT: Record<Locale, Dictionary> = { | 117 | 122 | br: { ...base, ...i18n.flatten({ ...br, ...uiBr }) }, | 118 | 123 | th: { ...base, ...i18n.flatten({ ...th, ...uiTh }) }, | 119 | 124 | bs: { ...base, ...i18n.flatten({ ...bs, ...uiBs }) }, | | 125 | + tr: { ...base, ...i18n.flatten({ ...tr, ...uiTr }) }, | 120 | 126 | } | 121 | 127 |
| 122 | 128 | const localeMatchers: Array<{ locale: Locale; match: (language: string) => boolean }> = [ | @@ -138,6 +144,7 @@ const localeMatchers: Array<{ locale: Locale; match: (language: string) => boole | 138 | 144 | { locale: "br", match: (language) => language.startsWith("pt") }, | 139 | 145 | { locale: "th", match: (language) => language.startsWith("th") }, | 140 | 146 | { locale: "bs", match: (language) => language.startsWith("bs") }, | | 147 | + { locale: "tr", match: (language) => language.startsWith("tr") }, | 141 | 148 | ] | 142 | 149 |
| 143 | 150 | type ParityKey = "command.session.previous.unseen" | "command.session.next.unseen" | @@ -157,6 +164,7 @@ const PARITY_CHECK: Record<Exclude<Locale, "en">, Record<ParityKey, string>> = { | 157 | 164 | br, | 158 | 165 | th, | 159 | 166 | bs, | | 167 | + tr, | 160 | 168 | } | 161 | 169 | void PARITY_CHECK | 162 | 170 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/i18n/en.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -397,6 +397,7 @@ export const dict = { | 397 | 397 | "language.br": "Português (Brasil)", | 398 | 398 | "language.bs": "Bosanski", | 399 | 399 | "language.th": "ไทย", | | 400 | + "language.tr": "Türkçe", | 400 | 401 |
| 401 | 402 | "toast.language.title": "Language", | 402 | 403 | "toast.language.description": "Switched to {{language}}", | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/i18n/parity.test.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,8 +15,9 @@ import { dict as ru } from "./ru" | 15 | 15 | import { dict as th } from "./th" | 16 | 16 | import { dict as zh } from "./zh" | 17 | 17 | import { dict as zht } from "./zht" | | 18 | +import { dict as tr } from "./tr" | 18 | 19 |
| 19 | | -const locales = [ar, br, bs, da, de, es, fr, ja, ko, no, pl, ru, th, zh, zht] | | 20 | +const locales = [ar, br, bs, da, de, es, fr, ja, ko, no, pl, ru, th, tr, zh, zht] | 20 | 21 | const keys = ["command.session.previous.unseen", "command.session.next.unseen"] as const | 21 | 22 |
| 22 | 23 | describe("i18n parity", () => { | |
|