feat(i18n): add Japanese (ja) locale (#1694)

* feat(i18n): add Japanese (ja) locale

- Add packages/app/src/i18n/resources/ja.ts with 1287 keys matching en.ts
- Register ja in i18next.ts, locales.ts (SupportedLocale, LANGUAGE_OPTIONS,
  SUPPORTED_LANGUAGES, LANGUAGE_NATIVE_NAMES, LANGUAGE_NAMES_BY_LOCALE,
  resolveSupportedLocale)
- Add ja label key to all six existing locale files (ar, en, es, fr, ru, zh-CN)
- Update locales.test.ts to cover ja in all relevant assertions

Translation reviewed by Codex across four passes; terminology, placeholder
parity, and naturalness confirmed clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(i18n): add ja to resources.test.ts and fix test descriptions

- Import ja and add to key-parity, fallback-ratio, interpolation, and
  model-count assertions in resources.test.ts
- Update test descriptions to say "all supported language(s)" instead of
  "UN official language(s)" (ja is not a UN official language)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: add Japanese README (README.ja.md)

Add README.ja.md translated from the English source, reviewed by Codex
across two passes. Link it in the language navigation of README.md and
README.zh-CN.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: apply oxfmt formatting to locales.ts and ja.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sysCat64
2026-06-24 13:11:35 +00:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 70ea960153
commit 507345dbee
14 changed files with 2139 additions and 10 deletions
+31 -2
View File
@@ -1,4 +1,4 @@
export type SupportedLocale = "ar" | "en" | "es" | "fr" | "ru" | "zh-CN";
export type SupportedLocale = "ar" | "en" | "es" | "fr" | "ja" | "ru" | "zh-CN";
export type AppLanguage = "system" | SupportedLocale;
export interface LanguageOption {
@@ -14,16 +14,27 @@ export const LANGUAGE_OPTIONS: LanguageOption[] = [
{ value: "en", labelKey: "settings.general.language.options.en" },
{ value: "es", labelKey: "settings.general.language.options.es" },
{ value: "fr", labelKey: "settings.general.language.options.fr" },
{ value: "ja", labelKey: "settings.general.language.options.ja" },
{ value: "ru", labelKey: "settings.general.language.options.ru" },
{ value: "zh-CN", labelKey: "settings.general.language.options.zhCN" },
];
const SUPPORTED_LANGUAGES = new Set<AppLanguage>(["system", "ar", "en", "es", "fr", "ru", "zh-CN"]);
const SUPPORTED_LANGUAGES = new Set<AppLanguage>([
"system",
"ar",
"en",
"es",
"fr",
"ja",
"ru",
"zh-CN",
]);
const LANGUAGE_NATIVE_NAMES: Record<SupportedLocale, string> = {
ar: "العربية",
en: "English",
es: "Español",
fr: "Français",
ja: "日本語",
ru: "Русский",
"zh-CN": "简体中文",
};
@@ -33,6 +44,7 @@ const LANGUAGE_NAMES_BY_LOCALE: Record<SupportedLocale, Record<SupportedLocale,
en: "الإنجليزية",
es: "الإسبانية",
fr: "الفرنسية",
ja: "اليابانية",
ru: "الروسية",
"zh-CN": "الصينية المبسطة",
},
@@ -41,6 +53,7 @@ const LANGUAGE_NAMES_BY_LOCALE: Record<SupportedLocale, Record<SupportedLocale,
en: "English",
es: "Spanish",
fr: "French",
ja: "Japanese",
ru: "Russian",
"zh-CN": "Simplified Chinese",
},
@@ -49,6 +62,7 @@ const LANGUAGE_NAMES_BY_LOCALE: Record<SupportedLocale, Record<SupportedLocale,
en: "inglés",
es: "español",
fr: "francés",
ja: "japonés",
ru: "ruso",
"zh-CN": "chino simplificado",
},
@@ -57,14 +71,25 @@ const LANGUAGE_NAMES_BY_LOCALE: Record<SupportedLocale, Record<SupportedLocale,
en: "anglais",
es: "espagnol",
fr: "français",
ja: "japonais",
ru: "russe",
"zh-CN": "chinois simplifié",
},
ja: {
ar: "アラビア語",
en: "英語",
es: "スペイン語",
fr: "フランス語",
ja: "日本語",
ru: "ロシア語",
"zh-CN": "簡体字中国語",
},
ru: {
ar: "арабский",
en: "английский",
es: "испанский",
fr: "французский",
ja: "японский",
ru: "русский",
"zh-CN": "упрощенный китайский",
},
@@ -73,6 +98,7 @@ const LANGUAGE_NAMES_BY_LOCALE: Record<SupportedLocale, Record<SupportedLocale,
en: "英语",
es: "西班牙语",
fr: "法语",
ja: "日语",
ru: "俄语",
"zh-CN": "简体中文",
},
@@ -124,6 +150,9 @@ export function resolveSupportedLocale(
if (normalized === "fr" || normalized.startsWith("fr-")) {
return "fr";
}
if (normalized === "ja" || normalized.startsWith("ja-")) {
return "ja";
}
if (normalized === "ru" || normalized.startsWith("ru-")) {
return "ru";
}