From 1ef6bada3650e16dac61e3a75fc85ee4289c3c40 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 5 Apr 2026 14:38:03 +0100 Subject: [PATCH] feat(ui): add tr id and pl control ui locales --- scripts/control-ui-i18n.ts | 9 +++++++++ ui/src/i18n/lib/registry.ts | 24 ++++++++++++++++++++++++ ui/src/i18n/lib/types.ts | 14 +++++++++++++- ui/src/i18n/locales/en.ts | 3 +++ ui/src/i18n/test/translate.test.ts | 9 +++++++++ 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/scripts/control-ui-i18n.ts b/scripts/control-ui-i18n.ts index 01106b6f05c..b08603ccd37 100644 --- a/scripts/control-ui-i18n.ts +++ b/scripts/control-ui-i18n.ts @@ -87,6 +87,9 @@ const LOCALE_ENTRIES: readonly LocaleEntry[] = [ { locale: "ja-JP", fileName: "ja-JP.ts", exportName: "ja_JP", languageKey: "jaJP" }, { locale: "ko", fileName: "ko.ts", exportName: "ko", languageKey: "ko" }, { locale: "fr", fileName: "fr.ts", exportName: "fr", languageKey: "fr" }, + { locale: "tr", fileName: "tr.ts", exportName: "tr", languageKey: "tr" }, + { locale: "id", fileName: "id.ts", exportName: "id", languageKey: "id" }, + { locale: "pl", fileName: "pl.ts", exportName: "pl", languageKey: "pl" }, ]; const DEFAULT_GLOSSARY: readonly GlossaryEntry[] = [ @@ -169,6 +172,12 @@ function prettyLanguageLabel(locale: string): string { return "Korean"; case "fr": return "French"; + case "tr": + return "Turkish"; + case "id": + return "Indonesian"; + case "pl": + return "Polish"; case "de": return "German"; case "es": diff --git a/ui/src/i18n/lib/registry.ts b/ui/src/i18n/lib/registry.ts index 19d216d746f..06ab5c37363 100644 --- a/ui/src/i18n/lib/registry.ts +++ b/ui/src/i18n/lib/registry.ts @@ -19,6 +19,9 @@ const LAZY_LOCALES: readonly LazyLocale[] = [ "ja-JP", "ko", "fr", + "tr", + "id", + "pl", ]; const LAZY_LOCALE_REGISTRY: Record = { @@ -54,6 +57,18 @@ const LAZY_LOCALE_REGISTRY: Record = { exportName: "fr", loader: () => import("../locales/fr.ts"), }, + tr: { + exportName: "tr", + loader: () => import("../locales/tr.ts"), + }, + id: { + exportName: "id", + loader: () => import("../locales/id.ts"), + }, + pl: { + exportName: "pl", + loader: () => import("../locales/pl.ts"), + }, }; export const SUPPORTED_LOCALES: ReadonlyArray = [DEFAULT_LOCALE, ...LAZY_LOCALES]; @@ -88,6 +103,15 @@ export function resolveNavigatorLocale(navLang: string): Locale { if (navLang.startsWith("fr")) { return "fr"; } + if (navLang.startsWith("tr")) { + return "tr"; + } + if (navLang.startsWith("id")) { + return "id"; + } + if (navLang.startsWith("pl")) { + return "pl"; + } return DEFAULT_LOCALE; } diff --git a/ui/src/i18n/lib/types.ts b/ui/src/i18n/lib/types.ts index bf69d5586da..e507224c22e 100644 --- a/ui/src/i18n/lib/types.ts +++ b/ui/src/i18n/lib/types.ts @@ -1,6 +1,18 @@ export type TranslationMap = { [key: string]: string | TranslationMap }; -export type Locale = "en" | "zh-CN" | "zh-TW" | "pt-BR" | "de" | "es" | "ja-JP" | "ko" | "fr"; +export type Locale = + | "en" + | "zh-CN" + | "zh-TW" + | "pt-BR" + | "de" + | "es" + | "ja-JP" + | "ko" + | "fr" + | "tr" + | "id" + | "pl"; export interface I18nConfig { locale: Locale; diff --git a/ui/src/i18n/locales/en.ts b/ui/src/i18n/locales/en.ts index bb40de93106..29576d1d53e 100644 --- a/ui/src/i18n/locales/en.ts +++ b/ui/src/i18n/locales/en.ts @@ -402,6 +402,9 @@ export const en: TranslationMap = { jaJP: "日本語 (Japanese)", ko: "한국어 (Korean)", fr: "Français (French)", + tr: "Türkçe (Turkish)", + id: "Bahasa Indonesia (Indonesian)", + pl: "Polski (Polish)", }, cron: { summary: { diff --git a/ui/src/i18n/test/translate.test.ts b/ui/src/i18n/test/translate.test.ts index 0fe141fab1f..1c7e7e84f36 100644 --- a/ui/src/i18n/test/translate.test.ts +++ b/ui/src/i18n/test/translate.test.ts @@ -5,9 +5,12 @@ import { de } from "../locales/de.ts"; import { en } from "../locales/en.ts"; import { es } from "../locales/es.ts"; import { fr } from "../locales/fr.ts"; +import { id } from "../locales/id.ts"; import { ja_JP } from "../locales/ja-JP.ts"; import { ko } from "../locales/ko.ts"; +import { pl } from "../locales/pl.ts"; import { pt_BR } from "../locales/pt-BR.ts"; +import { tr } from "../locales/tr.ts"; import { zh_CN } from "../locales/zh-CN.ts"; import { zh_TW } from "../locales/zh-TW.ts"; @@ -99,9 +102,12 @@ describe("i18n", () => { expect((de.common as { version?: string }).version).toBeTruthy(); expect((es.common as { version?: string }).version).toBeTruthy(); expect((fr.common as { version?: string }).version).toBeTruthy(); + expect((id.common as { version?: string }).version).toBeTruthy(); expect((ja_JP.common as { version?: string }).version).toBeTruthy(); expect((ko.common as { version?: string }).version).toBeTruthy(); + expect((pl.common as { version?: string }).version).toBeTruthy(); expect((pt_BR.common as { version?: string }).version).toBeTruthy(); + expect((tr.common as { version?: string }).version).toBeTruthy(); expect((zh_CN.common as { version?: string }).version).toBeTruthy(); expect((zh_TW.common as { version?: string }).version).toBeTruthy(); }); @@ -112,9 +118,12 @@ describe("i18n", () => { de, es, fr, + id, ja_JP, ko, + pl, pt_BR, + tr, zh_CN, zh_TW, })) {