Skip to content

Commit a325c9a

Browse files
vaur94Ugur
andauthored
feat(app): add Turkish (tr) locale for app and ui packages (anomalyco#15278)
Co-authored-by: Ugur <ugur@example.com>
1 parent dc8c011 commit a325c9a

5 files changed

Lines changed: 965 additions & 1 deletion

File tree

packages/app/src/context/language.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { dict as no } from "@/i18n/no"
1919
import { dict as br } from "@/i18n/br"
2020
import { dict as th } from "@/i18n/th"
2121
import { dict as bs } from "@/i18n/bs"
22+
import { dict as tr } from "@/i18n/tr"
2223
import { dict as uiEn } from "@opencode-ai/ui/i18n/en"
2324
import { dict as uiZh } from "@opencode-ai/ui/i18n/zh"
2425
import { dict as uiZht } from "@opencode-ai/ui/i18n/zht"
@@ -35,6 +36,7 @@ import { dict as uiNo } from "@opencode-ai/ui/i18n/no"
3536
import { dict as uiBr } from "@opencode-ai/ui/i18n/br"
3637
import { dict as uiTh } from "@opencode-ai/ui/i18n/th"
3738
import { dict as uiBs } from "@opencode-ai/ui/i18n/bs"
39+
import { dict as uiTr } from "@opencode-ai/ui/i18n/tr"
3840

3941
export type Locale =
4042
| "en"
@@ -53,6 +55,7 @@ export type Locale =
5355
| "br"
5456
| "th"
5557
| "bs"
58+
| "tr"
5659

5760
type RawDictionary = typeof en & typeof uiEn
5861
type Dictionary = i18n.Flatten<RawDictionary>
@@ -78,6 +81,7 @@ const LOCALES: readonly Locale[] = [
7881
"no",
7982
"br",
8083
"th",
84+
"tr",
8185
]
8286

8387
const LABEL_KEY: Record<Locale, keyof Dictionary> = {
@@ -97,6 +101,7 @@ const LABEL_KEY: Record<Locale, keyof Dictionary> = {
97101
br: "language.br",
98102
th: "language.th",
99103
bs: "language.bs",
104+
tr: "language.tr",
100105
}
101106

102107
const base = i18n.flatten({ ...en, ...uiEn })
@@ -117,6 +122,7 @@ const DICT: Record<Locale, Dictionary> = {
117122
br: { ...base, ...i18n.flatten({ ...br, ...uiBr }) },
118123
th: { ...base, ...i18n.flatten({ ...th, ...uiTh }) },
119124
bs: { ...base, ...i18n.flatten({ ...bs, ...uiBs }) },
125+
tr: { ...base, ...i18n.flatten({ ...tr, ...uiTr }) },
120126
}
121127

122128
const localeMatchers: Array<{ locale: Locale; match: (language: string) => boolean }> = [
@@ -138,6 +144,7 @@ const localeMatchers: Array<{ locale: Locale; match: (language: string) => boole
138144
{ locale: "br", match: (language) => language.startsWith("pt") },
139145
{ locale: "th", match: (language) => language.startsWith("th") },
140146
{ locale: "bs", match: (language) => language.startsWith("bs") },
147+
{ locale: "tr", match: (language) => language.startsWith("tr") },
141148
]
142149

143150
type ParityKey = "command.session.previous.unseen" | "command.session.next.unseen"
@@ -157,6 +164,7 @@ const PARITY_CHECK: Record<Exclude<Locale, "en">, Record<ParityKey, string>> = {
157164
br,
158165
th,
159166
bs,
167+
tr,
160168
}
161169
void PARITY_CHECK
162170

packages/app/src/i18n/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ export const dict = {
397397
"language.br": "Português (Brasil)",
398398
"language.bs": "Bosanski",
399399
"language.th": "ไทย",
400+
"language.tr": "Türkçe",
400401

401402
"toast.language.title": "Language",
402403
"toast.language.description": "Switched to {{language}}",

packages/app/src/i18n/parity.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ import { dict as ru } from "./ru"
1515
import { dict as th } from "./th"
1616
import { dict as zh } from "./zh"
1717
import { dict as zht } from "./zht"
18+
import { dict as tr } from "./tr"
1819

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]
2021
const keys = ["command.session.previous.unseen", "command.session.next.unseen"] as const
2122

2223
describe("i18n parity", () => {

0 commit comments

Comments
 (0)