mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-11 09:11:13 +00:00
feat(ui): add tr id and pl control ui locales
This commit is contained in:
@@ -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":
|
||||
|
||||
@@ -19,6 +19,9 @@ const LAZY_LOCALES: readonly LazyLocale[] = [
|
||||
"ja-JP",
|
||||
"ko",
|
||||
"fr",
|
||||
"tr",
|
||||
"id",
|
||||
"pl",
|
||||
];
|
||||
|
||||
const LAZY_LOCALE_REGISTRY: Record<LazyLocale, LazyLocaleRegistration> = {
|
||||
@@ -54,6 +57,18 @@ const LAZY_LOCALE_REGISTRY: Record<LazyLocale, LazyLocaleRegistration> = {
|
||||
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<Locale> = [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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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,
|
||||
})) {
|
||||
|
||||
Reference in New Issue
Block a user