453ddc5e94
- plain Svelte 5 + TS + Vite (no SvelteKit); CSS-token design system (Telegram-ready), hash router, IndexedDB session - pure libs: domain model, premium/value maps ported from solver, board replay, placement state machine, i18n en/ru - in-memory mock transport + seed data; pnpm start runs lobby->active game->board with no backend - board: pointer-drag + tap placement, MakeMove (popup / 1s-hold commit), two-state zoom, blank chooser, exchange, hint, word-check, chat - Playwright smoke (mock) green; svelte-check clean; mock bundle ~37 KB gzip
18 lines
602 B
TypeScript
18 lines
602 B
TypeScript
// Reactive i18n layer. The locale is a rune, so any component that calls t()
|
|
// re-renders when the locale changes. The catalog + lookup are pure (see catalog.ts).
|
|
|
|
import { translate, type Locale, type MessageKey } from './catalog';
|
|
|
|
export { errorKey, localeFrom } from './catalog';
|
|
export type { Locale, MessageKey };
|
|
|
|
export const i18n = $state<{ locale: Locale }>({ locale: 'en' });
|
|
|
|
export function setLocale(locale: Locale): void {
|
|
i18n.locale = locale;
|
|
}
|
|
|
|
export function t(key: MessageKey, params?: Record<string, string | number>): string {
|
|
return translate(i18n.locale, key, params);
|
|
}
|