Repository navigation
i18n sync pipeline: backend YAML -> bundled frontend JSON (pattern 05) - #33
Merged
Merged
Conversation
Implements pattern 05:
- scripts/sync_i18n.py mirrors backend/config/i18n/*.yaml to
frontend/src/data/i18n/*.json (8 catalogs); make sync-i18n +
sync-i18n-check (drift gate).
- useI18n loads the bundled JSON via import.meta.glob (default 'de' eager,
the rest lazy chunks) instead of fetching GET /i18n/{lang}, so i18n needs
no backend roundtrip and works in a static/offline build. t() unchanged.
- i18n-bundle.test.ts pins that the bundle is populated.
tsc clean; eslint clean; Vitest 1201 passed; build OK (lang chunks bundled);
sync-i18n-check in sync. Closes #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #32
Implements pattern 05 (i18n sync) — the last documented pattern that was still "Partial". Backend YAML is the single source of truth; the frontend now consumes a bundled JSON mirror, so translations need no backend roundtrip and work in a static/offline build.
scripts/sync_i18n.pymirrorsbackend/config/i18n/*.yaml->frontend/src/data/i18n/*.json(8 catalogs: de/el/en/es/fr/ja/pt/tr).make sync-i18n+make sync-i18n-check(drift gate).useI18nrewired to load the bundled JSON viaimport.meta.glob(defaultdeeager for instant first paint, the others lazy chunks on language switch) instead ofapi.i18n.get(lang).t()and the public hook API are unchanged, so no component changes.i18n-bundle.test.tspins that the bundle is populated (a stale/empty bundle would make everyt()fall back to its key).sync-i18n-checkkeeps it honest.Green
tsc --noEmitclean.make sync-i18n-checkin sync. ESLint clean. Vitest 1201 passed. Build OK (precache 37->44: the bundled language chunks). complexity/file-size/dir gates still green.Note
The backend
/i18n/{lang}endpoint +api.i18n.getclient method are left in place (harmless; a dual-mode app could still use them) — just no longer the frontend's source for strings.