diff options
Diffstat (limited to 'web/src/lib/i18n/index.ts')
| -rw-r--r-- | web/src/lib/i18n/index.ts | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/web/src/lib/i18n/index.ts b/web/src/lib/i18n/index.ts index 5792835..f767394 100644 --- a/web/src/lib/i18n/index.ts +++ b/web/src/lib/i18n/index.ts @@ -1,15 +1,25 @@ /** - * UI string i18n (Phase 3: English first, locale plumbing in place). + * UI string i18n. * * The reference app generates its UI strings from `.arb` files (gen-l10n); - * here we port the English set as a plain object and keep the same shape so - * the other 9 locales can be dropped in later (Phase 6). `t()` falls back to - * English for any key a locale is missing. + * here each locale is a plain object ported from the corresponding + * `app_{locale}.arb` (Phase 6). `t()` falls back to English for any key a + * locale is missing — the same fallback gen-l10n applies (the non-English + * arb files cover a subset of the English key set). */ import { get, writable, type Writable } from 'svelte/store'; import { en } from './en'; +import { de } from './de'; +import { es } from './es'; +import { fr } from './fr'; +import { ko } from './ko'; +import { pl } from './pl'; +import { ru } from './ru'; +import { th } from './th'; +import { zh } from './zh'; +import { zh_Hant } from './zh_Hant'; export type Locale = | 'en' @@ -23,8 +33,19 @@ export type Locale = | 'zh' | 'zh_Hant'; -/** Locale → its string table. English is the only one ported in Phase 3. */ -const tables: Record<string, Record<string, string>> = { en }; +/** Locale → its string table (all 10 locales, Phase 6). */ +const tables: Record<string, Record<string, string>> = { + en, + de, + es, + fr, + ko, + pl, + ru, + th, + zh, + zh_Hant +}; const LOCALE_KEY = 'x-haven-locale'; @@ -50,9 +71,8 @@ locale.subscribe((value) => { /** * The locales offered in the settings picker. In-game card text, token names, - * and display names are translated for every one of these (the `/i18n/` files); - * the UI strings themselves fall back to English for any locale beyond `en` - * (only the English UI table is ported — Phase 6 ports the rest). + * and display names are translated for every one of these (the server's + * `/i18n/` files), and the UI string tables cover the same set (Phase 6). */ export const availableLocales: Locale[] = [ 'en', |
