mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
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:
1 parent
f5687cce1c
commit
e6b4d83084
50 files changed
+2215
-961
No files matched your search
+17
-21
@@ -2,14 +2,10 @@ import { motion } from 'motion/react'
|
||||
import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { Tag } from '@/components/ui/Tag'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { profile } from '@/data/profile'
|
||||
import { skillGroups } from '@/data/skills'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { field } from '@/i18n/field'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
|
||||
export function AboutPage() {
|
||||
const { lang } = useLanguage()
|
||||
const { ui: s, content: c } = useI18n()
|
||||
return (
|
||||
<>
|
||||
<InView>
|
||||
@@ -25,21 +21,21 @@ export function AboutPage() {
|
||||
}}
|
||||
>
|
||||
<SectionHeading
|
||||
title={strings.about.heading[lang]}
|
||||
subtitle={strings.about.subtitle[lang]}
|
||||
tag={strings.about.heading[lang]}
|
||||
title={s.about.heading}
|
||||
subtitle={s.about.subtitle}
|
||||
tag={s.about.heading}
|
||||
/>
|
||||
<p className="prose-lede lede-wide">
|
||||
{field(lang, profile.bio, profile.bioEn)}
|
||||
{c.profile.bio}
|
||||
</p>
|
||||
|
||||
<h3 className="subheading">
|
||||
{strings.about.engineeringTitle[lang]}
|
||||
{s.about.engineeringTitle}
|
||||
</h3>
|
||||
<div className="philosophy-grid">
|
||||
{profile.philosophy.map((point, i) => (
|
||||
{c.profile.philosophy.map((point, i) => (
|
||||
<motion.div
|
||||
key={point.title}
|
||||
key={point.id}
|
||||
className="philosophy-card"
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
@@ -48,8 +44,8 @@ export function AboutPage() {
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<h3>{field(lang, point.title, point.titleEn)}</h3>
|
||||
<p>{field(lang, point.description, point.descriptionEn)}</p>
|
||||
<h3>{point.title}</h3>
|
||||
<p>{point.description}</p>
|
||||
<div className="philosophy-keywords">
|
||||
{point.keywords.map((kw) => (
|
||||
<Tag key={kw}>{kw}</Tag>
|
||||
@@ -60,10 +56,10 @@ export function AboutPage() {
|
||||
</div>
|
||||
|
||||
<h3 className="subheading">
|
||||
{strings.about.exploringTitlePage[lang]}
|
||||
{s.about.exploringTitlePage}
|
||||
</h3>
|
||||
<div className="interests-list">
|
||||
{profile.currentInterests.map((interest) => (
|
||||
{c.profile.currentInterests.map((interest) => (
|
||||
<Tag key={interest} accent>
|
||||
{interest}
|
||||
</Tag>
|
||||
@@ -83,11 +79,11 @@ export function AboutPage() {
|
||||
visible: { opacity: 1, transition: { duration: 0.5 } },
|
||||
}}
|
||||
>
|
||||
<SectionHeading title={strings.about.expertise[lang]} />
|
||||
<SectionHeading title={s.about.expertise} />
|
||||
<div className="expertise-grid">
|
||||
{skillGroups.map((group, i) => (
|
||||
{c.skillGroups.map((group, i) => (
|
||||
<motion.div
|
||||
key={group.title}
|
||||
key={group.id}
|
||||
className="expertise-card"
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
@@ -96,7 +92,7 @@ export function AboutPage() {
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<h3>{field(lang, group.title, group.titleEn)}</h3>
|
||||
<h3>{group.title}</h3>
|
||||
<ul className="expertise-skills">
|
||||
{group.skills.map((skill: string) => (
|
||||
<li key={skill} className="expertise-skill">
|
||||
|
||||
@@ -2,10 +2,9 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { ContactLinks } from '@/components/ui/ContactLinks'
|
||||
import { motion } from 'motion/react'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
export function ContactPage() {
|
||||
const { lang } = useLanguage()
|
||||
const { ui: s } = useI18n()
|
||||
return (
|
||||
<InView>
|
||||
<motion.section
|
||||
@@ -19,7 +18,7 @@ export function ContactPage() {
|
||||
visible: { opacity: 1, transition: { duration: 0.5 } },
|
||||
}}
|
||||
>
|
||||
<SectionHeading title={strings.contact.heading[lang]} tag={strings.common.contactTag[lang]} />
|
||||
<SectionHeading title={s.contact.heading} tag={s.common.contactTag} />
|
||||
<ContactLinks />
|
||||
</motion.section>
|
||||
</InView>
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { motion } from 'motion/react'
|
||||
import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { experiences } from '@/data/experience'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { field } from '@/i18n/field'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
|
||||
export function ExperiencePage() {
|
||||
const { lang } = useLanguage()
|
||||
const { ui: s, content: c } = useI18n()
|
||||
return (
|
||||
<InView>
|
||||
<motion.section
|
||||
@@ -21,9 +18,9 @@ export function ExperiencePage() {
|
||||
visible: { opacity: 1, transition: { duration: 0.5 } },
|
||||
}}
|
||||
>
|
||||
<SectionHeading title={strings.experience.heading[lang]} tag={strings.common.experienceTag[lang]} />
|
||||
<SectionHeading title={s.experience.heading} tag={s.common.experienceTag} />
|
||||
<div className="timeline">
|
||||
{experiences.map((exp, i) => (
|
||||
{c.experiences.map((exp, i) => (
|
||||
<motion.div
|
||||
key={exp.id}
|
||||
className={exp.variant ? `timeline-entry timeline-entry-${exp.variant}` : 'timeline-entry'}
|
||||
@@ -34,7 +31,7 @@ export function ExperiencePage() {
|
||||
>
|
||||
<div className="timeline-marker" />
|
||||
<div className="timeline-header">
|
||||
<div className="timeline-title">{field(lang, exp.title, exp.titleEn)}</div>
|
||||
<div className="timeline-title">{exp.title}</div>
|
||||
<div className="timeline-company">{exp.company}</div>
|
||||
<div className="timeline-meta">
|
||||
<span className="timeline-duration">{exp.duration}</span>
|
||||
@@ -42,7 +39,7 @@ export function ExperiencePage() {
|
||||
</div>
|
||||
</div>
|
||||
<ul className="timeline-responsibilities">
|
||||
{field(lang, exp.responsibilities, exp.responsibilitiesEn).map((r) => (
|
||||
{exp.responsibilities.map((r) => (
|
||||
<li key={r}>{r}</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -50,8 +47,8 @@ export function ExperiencePage() {
|
||||
))}
|
||||
<div className="timeline-tldr">
|
||||
<span className="timeline-tldr-marker" aria-hidden="true" />
|
||||
<span className="timeline-tldr-chip">{strings.experience.tldr[lang]}</span>
|
||||
<p className="timeline-tldr-text">{strings.experience.tldrText[lang]}</p>
|
||||
<span className="timeline-tldr-chip">{s.experience.tldr}</span>
|
||||
<p className="timeline-tldr-text">{s.experience.tldrText}</p>
|
||||
</div>
|
||||
</div>
|
||||
</motion.section>
|
||||
|
||||
@@ -2,11 +2,10 @@ import {SectionHeading} from '@/components/ui/SectionHeading'
|
||||
import {motion} from 'motion/react'
|
||||
import {InView} from '@/components/ui/InView'
|
||||
|
||||
import {useLanguage} from '@/hooks/useLanguage'
|
||||
import {strings} from '@/i18n/strings'
|
||||
import {useI18n} from '@/i18n/provider'
|
||||
|
||||
export function PhilosophyPage() {
|
||||
const {lang} = useLanguage()
|
||||
const {ui: s} = useI18n()
|
||||
return (
|
||||
<InView>
|
||||
<motion.section
|
||||
@@ -20,11 +19,11 @@ export function PhilosophyPage() {
|
||||
visible: {opacity: 1, transition: {duration: 0.5}},
|
||||
}}
|
||||
>
|
||||
<SectionHeading id="philosophy-heading" title={strings.philosophy.heading[lang]} tag={strings.philosophy.heading[lang]}/>
|
||||
<SectionHeading id="philosophy-heading" title={s.philosophy.heading} tag={s.philosophy.heading}/>
|
||||
<div className="prose prose-wide">
|
||||
{strings.philosophy.quotes.map((quote, i) => (
|
||||
{s.philosophy.quotes.map((quote, i) => (
|
||||
<motion.div
|
||||
key={quote.title[lang]}
|
||||
key={i}
|
||||
className="philosophy-quote"
|
||||
initial={{opacity: 0, y: 24}}
|
||||
whileInView={{opacity: 1, y: 0}}
|
||||
@@ -32,9 +31,13 @@ export function PhilosophyPage() {
|
||||
transition={{duration: 0.45, ease: 'easeOut', delay: i * 0.08}}
|
||||
>
|
||||
<h3>
|
||||
{quote.title[lang]}
|
||||
{quote.title}
|
||||
</h3>
|
||||
<div dangerouslySetInnerHTML={{__html: quote.details[lang]}}/>
|
||||
<div>
|
||||
{quote.details.map((detail, j) => (
|
||||
<p key={j}>{detail}</p>
|
||||
))}
|
||||
</div>
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -3,10 +3,7 @@ import { motion, type Transition } from 'motion/react'
|
||||
import { Badge } from '@/components/ui/Badge'
|
||||
import { Tag } from '@/components/ui/Tag'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { projects } from '@/data/projects'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { field } from '@/i18n/field'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
|
||||
const sectionVariants = {
|
||||
hidden: { opacity: 0 },
|
||||
@@ -21,8 +18,8 @@ const itemTransition = (delay: number): Transition => ({
|
||||
|
||||
export function ProjectDetailPage() {
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const { lang } = useLanguage()
|
||||
const project = projects.find((p) => p.id === id)
|
||||
const { ui: s, content: c } = useI18n()
|
||||
const project = c.projects.find((p) => p.id === id)
|
||||
|
||||
if (!project) {
|
||||
return (
|
||||
@@ -34,9 +31,9 @@ export function ProjectDetailPage() {
|
||||
viewport={{ once: true, amount: 0.1 }}
|
||||
variants={sectionVariants}
|
||||
>
|
||||
<h2>{strings.projectDetail.notFound[lang]}</h2>
|
||||
<h2>{s.projectDetail.notFound}</h2>
|
||||
<p>
|
||||
<Link to="/projects">{strings.projectDetail.backToProjects[lang]} ←</Link>
|
||||
<Link to="/projects">{s.projectDetail.backToProjects} ←</Link>
|
||||
</p>
|
||||
</motion.section>
|
||||
</InView>
|
||||
@@ -54,7 +51,7 @@ export function ProjectDetailPage() {
|
||||
variants={sectionVariants}
|
||||
>
|
||||
<Link to="/projects" className="back-link">
|
||||
{strings.projectDetail.backToProjects[lang]} ←
|
||||
{s.projectDetail.backToProjects} ←
|
||||
</Link>
|
||||
|
||||
<motion.div
|
||||
@@ -64,8 +61,8 @@ export function ProjectDetailPage() {
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={itemTransition(0)}
|
||||
>
|
||||
<h1 id="project-title" style={{ flex: 1 }}>{field(lang, project.title, project.titleEn)}</h1>
|
||||
<Badge variant="outline">{strings.projects.categories[project.category][lang]}</Badge>
|
||||
<h1 id="project-title" style={{ flex: 1 }}>{project.title}</h1>
|
||||
<Badge variant="outline">{s.projects.categories[project.category]}</Badge>
|
||||
</motion.div>
|
||||
|
||||
<motion.p
|
||||
@@ -75,7 +72,7 @@ export function ProjectDetailPage() {
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={itemTransition(0.08)}
|
||||
>
|
||||
{field(lang, project.summary, project.summaryEn)}
|
||||
{project.summary}
|
||||
</motion.p>
|
||||
|
||||
<div className="prose">
|
||||
@@ -86,7 +83,7 @@ export function ProjectDetailPage() {
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={itemTransition(0.16)}
|
||||
>
|
||||
<h3>{strings.projectDetail.impact[lang]}</h3>
|
||||
<h3>{s.projectDetail.impact}</h3>
|
||||
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap' }}>
|
||||
{project.metrics.map((m) => (
|
||||
<span key={m} className="achievement-metric">
|
||||
@@ -103,7 +100,7 @@ export function ProjectDetailPage() {
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={itemTransition(0.24)}
|
||||
>
|
||||
<h3>{strings.projectDetail.role[lang]}</h3>
|
||||
<h3>{s.projectDetail.role}</h3>
|
||||
<p>{project.role}</p>
|
||||
</motion.div>
|
||||
|
||||
@@ -113,7 +110,7 @@ export function ProjectDetailPage() {
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={itemTransition(0.32)}
|
||||
>
|
||||
<h3>{strings.projectDetail.technologies[lang]}</h3>
|
||||
<h3>{s.projectDetail.technologies}</h3>
|
||||
<div className="philosophy-keywords">
|
||||
{project.technologies.map((tech) => (
|
||||
<Tag key={tech}>{tech}</Tag>
|
||||
@@ -129,7 +126,7 @@ export function ProjectDetailPage() {
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={itemTransition(0.4)}
|
||||
>
|
||||
{strings.projectDetail.experiments[lang]}
|
||||
{s.projectDetail.experiments}
|
||||
</motion.h3>
|
||||
{project.sections.map((section, idx) => (
|
||||
<motion.div
|
||||
@@ -140,8 +137,8 @@ export function ProjectDetailPage() {
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={itemTransition(0.48 + idx * 0.08)}
|
||||
>
|
||||
<h4>{field(lang, section.title, section.titleEn)}</h4>
|
||||
<p>{field(lang, section.content, section.contentEn)}</p>
|
||||
<h4>{section.title}</h4>
|
||||
<p>{section.content}</p>
|
||||
<Tag accent>{section.type}</Tag>
|
||||
</motion.div>
|
||||
))}
|
||||
|
||||
@@ -2,17 +2,15 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { Badge } from '@/components/ui/Badge'
|
||||
import { motion } from 'motion/react'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { projects } from '@/data/projects'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { field } from '@/i18n/field'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
|
||||
import { Link } from 'react-router'
|
||||
|
||||
|
||||
const MotionLink = motion.create(Link)
|
||||
|
||||
export function ProjectsListPage() {
|
||||
const { lang } = useLanguage()
|
||||
const { ui: s, content: c } = useI18n()
|
||||
return (
|
||||
<InView>
|
||||
<motion.section
|
||||
@@ -26,9 +24,9 @@ export function ProjectsListPage() {
|
||||
visible: { opacity: 1, transition: { duration: 0.5 } },
|
||||
}}
|
||||
>
|
||||
<SectionHeading title={strings.projects.all[lang]} tag={strings.projects.all[lang]} />
|
||||
<SectionHeading title={s.projects.all} tag={s.projects.all} />
|
||||
<div className="projects-grid">
|
||||
{projects.map((project, i) => (
|
||||
{c.projects.map((project, i) => (
|
||||
<MotionLink
|
||||
key={project.id}
|
||||
to={`/projects/${project.id}`}
|
||||
@@ -41,12 +39,12 @@ export function ProjectsListPage() {
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<div className="project-card-header">
|
||||
<h3>{field(lang, project.title, project.titleEn)}</h3>
|
||||
<h3>{project.title}</h3>
|
||||
<Badge variant="outline">
|
||||
{strings.projects.categories[project.category][lang]}
|
||||
{s.projects.categories[project.category]}
|
||||
</Badge>
|
||||
</div>
|
||||
<p className="project-card-summary">{field(lang, project.summary, project.summaryEn)}</p>
|
||||
<p className="project-card-summary">{project.summary}</p>
|
||||
<div className="project-card-techs">
|
||||
{project.technologies.slice(0, 4).map((tech) => (
|
||||
<span key={tech} className="tag">
|
||||
@@ -54,7 +52,7 @@ export function ProjectsListPage() {
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<span className="project-card-cta">{strings.projects.viewDetails[lang]} →</span>
|
||||
<span className="project-card-cta">{s.projects.viewDetails} →</span>
|
||||
</MotionLink>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user