refactor(i18n): split content into structure JSON and per-language dictionaries

Phase 1 of spec-v4-live-edit: data/i18n foundation, no visible feature.

- src/data/{profile,skills,experience,projects}.json: language-neutral
  structure documents with thin typed loaders; all prose moved to
  src/i18n/locales/{vi,en}/content.json; chrome strings to ui.json
- src/i18n/: dict-types, cross-document validator (runs at module load and
  via pnpm validate:content), loader joining structure+text once (UI/CONTENT),
  I18nProvider/useI18n mounted in App under LanguageProvider
- all 22 consumers read joined records via useI18n(); field.ts and
  strings.ts deleted; *En field pairs removed from the domain types
- hero tagline renders as plain-text segments (D9); philosophy quotes as
  paragraph arrays; footer display name now localizes per language (D6)
- resume generator consumes UI/CONTENT; generated resume HTML verified
  byte-identical (EN+VI) before/after the migration
- AGENTS.md and v3/v3-i18n + v4 specs updated; deploy.yml concurrency group
This commit is contained in:
dong.nguyen committed 2026-10-22 07:29:06 +07:00
1 parent f5687cce1c
commit e6b4d83084
50 files changed
+2215 -961

No files matched your search

+4 -2
View File
@@ -14,8 +14,10 @@ Add full English/Vietnamese bilingual support to the portfolio. Users can toggle
**Content lives in data, not in layout.** Every user-facing string must be defined in a centralized module — never hardcoded in JSX. This ensures:
1. **Phase 1 (frontend):** All strings in `src/i18n/strings.ts`, consumed via `useLanguage()` hook
2. **Phase 2 (backend):** Replace `src/i18n/strings.ts` with API calls — zero component changes
3. **Future-proof:** Adding a new language requires only updating the strings module and data layer, not touching components
2. **Phase 2 (backend):** Replace `src/i18n/strings.ts` with API calls — zero component changes — **superseded 2026-10-22** by `spec-v4-live-edit.md`: strings and content moved to per-language JSON dictionaries (`src/i18n/locales/`), consumed through `useI18n()`; `strings.ts` and `field.ts` are deleted. The "zero component changes" property carried over — every consumer switched to the provider in the same migration.
3. **Future-proof:** Adding a new language requires only updating the strings module and data layer, not touching components — now literally true: a new language is a new locale directory plus one `Language` union member (§3.1 of the v4 spec).
> **Status 2026-10-22:** the Phase-2 rows below describe the v3 plan and are kept for history; the shipped implementation is the v4 one. Rows 25–27 are done by the v4 migration.
## Implementation Progress