feat(dashboard): add i18n runtime with per-locale code-splitting (U3)
Initialize the browser i18next instance with lazy per-locale catalog loading, localStorage->navigator->htmlTag detection, script-aware zh fallback, and the shared @fusion/i18n config. Catalogs are synced from @fusion/i18n into a gitignored app/locales/ (predev/prebuild) and imported app-relative so Vite emits one chunk per locale/namespace (verified: 15 chunks, none inlined into the main bundle). First paint is gated on i18nReady to avoid raw-key flashes; <I18nextProvider> wraps the App provider stack; vendor-i18n manualChunk added. A build-assertion script (verify:locale-chunks) guards the KTD3a splitting invariant. Fallback/namespace behavior is covered by @fusion/i18n config tests; the live instance is verified via the build assertion rather than a unit test (the dynamic catalog backend is impractical to exercise in vitest). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,8 +52,12 @@
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"gen:locales": "node scripts/sync-locales.mjs",
|
||||
"verify:locale-chunks": "node scripts/assert-locale-chunks.mjs",
|
||||
"prebuild": "node scripts/sync-locales.mjs",
|
||||
"build": "vite build && tsc",
|
||||
"build:client": "vite build",
|
||||
"predev:serve": "node scripts/sync-locales.mjs",
|
||||
"dev": "pnpm build && pnpm typecheck && pnpm dev:serve",
|
||||
"dev:serve": "vite dev",
|
||||
"pretest": "node ../../scripts/ensure-test-artifacts.mjs",
|
||||
|
||||
Reference in New Issue
Block a user