mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
refactor(i18n): move person text out of ui.json and localize structure-held strings (spec-v4 rows 18-19)
Row 18: ui.about.subtitle/experience.tldrText/philosophy.quotes -> profile.subtitle/.tldr/.philosophyQuotes in content.{vi,en}.json; call sites repointed with EditableText wrap; SectionHeading subtitle prop becomes ReactNode; edit.fields labels added. Row 19: experience.company/.duration, projects.role/.metrics, profile.currentInterests/.roles, philosophy keywords move to text documents; VI carries localized dates/company labels/metrics, en overrides with originals, proper nouns and term lists identical (en omits); draft templates, JsonPanel hints, loader comments, resume TL;DR follow the new shapes. Verified: build, validate:content, lint (no new warnings), smoke-draft 7/7, per-language SSR marker smoke on affected routes, build:resume-all.
This commit is contained in:
1 parent
2c3ee8271d
commit
fecbd44899
23 files changed
+273
-169
No files matched your search
@@ -69,11 +69,11 @@ Personal engineering portfolio — multi-page SPA built with React + TypeScript
|
||||
|
||||
Content is split once, at authoring time, into language-neutral **structure documents** and per-language **text/UI dictionaries**, joined once at load (spec: `docs/design/specs/v4/spec-v4-live-edit.md`).
|
||||
|
||||
- `src/data/profile.json` + `profile.ts` loader — links, social handles (`githubHandle`, `linkedinHandle`, `telegramHandle`), messaging URLs (`telegramUrl`), `firstName`/`lastName` — the Contact cards render `@{c.profile.githubHandle}`, never a literal; name / title / tagline / bio are text, so they live in the content dictionaries
|
||||
- `src/data/profile.json` + `profile.ts` loader — links, social handles (`githubHandle`, `linkedinHandle`, `telegramHandle`), messaging URLs (`telegramUrl`), `firstName`/`lastName`, the ordered philosophy id list — the Contact cards render `@{c.profile.githubHandle}`, never a literal; name / title / tagline / bio / about-subtitle / career TL;DR / interests / roles / philosophy quotes + keywords are text, so they live in the content dictionaries
|
||||
- `src/data/skills.json` + `skills.ts` loader — skill groups: `{id, skills}`; group titles are text
|
||||
- `src/data/experience.json` + `experience.ts` loader — work history: company / duration / location / logo / optional `variant: 'current' | 'gap'` (timeline decoration: live node / career break); titles and responsibilities are text
|
||||
- `src/data/projects.json` + `projects.ts` loader — cards: category / role / technologies / metrics / featured / `sections[].{id, type}`; titles, summaries and section prose are text
|
||||
- `src/i18n/locales/{vi,en}/content.json` — all content text, keyed by the structure ids; `src/i18n/locales/{vi,en}/ui.json` — every chrome string in its own language (nav group labels, Mode options, language names `langEn` / `langVi`, action labels, social `aria-label`s, the resume's section labels)
|
||||
- `src/data/experience.json` + `experience.ts` loader — work history: id / location / logo / optional `variant: 'current' | 'gap'` (timeline decoration: live node / career break); company, duration, titles and responsibilities are text — the VI document carries localized dates ("11/2026 – nay") and company labels, en overrides with the originals, proper nouns identical per language
|
||||
- `src/data/projects.json` + `projects.ts` loader — cards: category / technologies / featured / `sections[].{id, type}`; titles, summaries, role, metrics and section prose are text (role follows the owner's EN title convention; metrics are localized)
|
||||
- `src/i18n/locales/{vi,en}/content.json` — all content text, keyed by the structure ids; the `profile` record is fixed-keyed (`name`, `title`, `bio`, `subtitle`, `tldr`, `tagline`, `currentInterests`, `roles`, `philosophyQuotes`, `philosophy.<id>.{title, description, keywords}`); `src/i18n/locales/{vi,en}/ui.json` — chrome strings only, in each language (nav group labels, Mode options, language names `langEn` / `langVi`, action labels, social `aria-label`s, the resume's section labels, edit-mode labels) — person text never lives here
|
||||
- `src/i18n/index.ts` — load + validate + join ONCE at module load; exports `UI` and `CONTENT` as `Record<Language, Resolved…>`; `src/i18n/dict-types.ts` carries the document types; `src/i18n/validate.ts` + `scripts/validate-content.ts` enforce the cross-document rules (orphan or missing keys, HTML markup in text values) — a malformed document fails `pnpm build`, CI, and the browser load, never a silent half-render
|
||||
- `src/i18n/provider.tsx` — `I18nProvider` wraps the app; components consume `const { ui: s, content: c } = useI18n()`: `s` is the chrome of the current language, `c` the joined records (`c.profile`, `c.skillGroups`, `c.experiences`, `c.projects`). There is no `field()` and no `*En` field pair anymore
|
||||
- Translation is a JSON edit, never a component edit; a new language is a new locale directory plus one `Language` union member
|
||||
|
||||
Reference in new issue
Block a user