mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
fix(i18n): complete phase 1 - translate section tags, replace lang checks, dedup download component
- Replace hardcoded SectionHeading tags with i18n strings (7 files) - Replace 17 lang === 'vi' checks with useField/useFieldArray hooks - Extract shared DownloadResumeDropdown component (Hero + DownloadResume) - Move langLabels to src/data/resume.ts as resumeLanguageLabels - Update feedback docs with resolution status
This commit is contained in:
1 parent
72a832c781
commit
4996a91a77
15 files changed
+489
-158
No files matched your search
@@ -16,7 +16,7 @@ export function AboutPage() {
|
||||
<SectionHeading
|
||||
title={strings.about.heading[lang]}
|
||||
subtitle={strings.about.subtitle[lang]}
|
||||
tag="About"
|
||||
tag={strings.about.heading[lang]}
|
||||
/>
|
||||
<div style={{ maxWidth: '700px' }}>
|
||||
<p style={{ fontSize: '18px', marginBottom: '32px' }}>
|
||||
@@ -59,7 +59,7 @@ export function AboutPage() {
|
||||
<div className="expertise-grid">
|
||||
{skillGroups.map((group) => (
|
||||
<div key={group.title} className="expertise-card">
|
||||
<h3>{lang === 'vi' ? group.title : group.titleEn}</h3>
|
||||
<h3>{useField(group.title, group.titleEn)}</h3>
|
||||
<ul className="expertise-skills">
|
||||
{group.skills.map((skill: string) => (
|
||||
<li key={skill} className="expertise-skill">
|
||||
|
||||
@@ -9,7 +9,7 @@ export function EngineeringPage() {
|
||||
const { lang } = useLanguage()
|
||||
return (
|
||||
<section className="section container-content" aria-labelledby="engineering-heading">
|
||||
<SectionHeading title={strings.engineering.heading[lang]} tag="Engineering" />
|
||||
<SectionHeading title={strings.engineering.heading[lang]} tag={strings.engineering.heading[lang]} />
|
||||
|
||||
{engineeringCategoryKeys.map((catKey) => (
|
||||
<div key={catKey} style={{ marginBottom: '48px' }}>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { experiences } from '@/data/experience'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField, useFieldArray } from '@/i18n/useField'
|
||||
|
||||
export function ExperiencePage() {
|
||||
const { lang } = useLanguage()
|
||||
@@ -13,7 +14,7 @@ export function ExperiencePage() {
|
||||
<div key={exp.id} className="timeline-entry">
|
||||
<div className="timeline-marker" />
|
||||
<div className="timeline-header">
|
||||
<div className="timeline-title">{lang === 'vi' ? exp.title : exp.titleEn}</div>
|
||||
<div className="timeline-title">{useField(exp.title, exp.titleEn)}</div>
|
||||
<div className="timeline-company">{exp.company}</div>
|
||||
<div className="timeline-duration">{exp.duration}</div>
|
||||
{exp.location && (
|
||||
@@ -21,16 +22,16 @@ export function ExperiencePage() {
|
||||
)}
|
||||
</div>
|
||||
<ul className="timeline-responsibilities">
|
||||
{(lang === 'vi' ? exp.responsibilities : exp.responsibilitiesEn ?? []).map((r) => (
|
||||
{useFieldArray(exp.responsibilities, exp.responsibilitiesEn).map((r) => (
|
||||
<li key={r}>{r}</li>
|
||||
))}
|
||||
</ul>
|
||||
{exp.achievements?.map((achievement) => (
|
||||
<div key={achievement.id} className="achievement">
|
||||
<div className="achievement-title">{achievement.title}</div>
|
||||
<div className="achievement-context">{lang === 'vi' ? achievement.context : achievement.contextEn}</div>
|
||||
<div className="achievement-context">{useField(achievement.context, achievement.contextEn)}</div>
|
||||
<div style={{ fontSize: '14px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
|
||||
{lang === 'vi' ? achievement.impact : achievement.impactEn}
|
||||
{useField(achievement.impact, achievement.impactEn)}
|
||||
</div>
|
||||
{achievement.metrics && achievement.metrics.length > 0 && (
|
||||
<div style={{ marginBottom: '8px' }}>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Tag } from '@/components/ui/Tag'
|
||||
import { projects } from '@/data/projects'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField } from '@/i18n/useField'
|
||||
|
||||
|
||||
export function ProjectDetailPage() {
|
||||
@@ -34,7 +35,7 @@ export function ProjectDetailPage() {
|
||||
</div>
|
||||
|
||||
<p style={{ fontSize: '18px', color: 'var(--text-secondary)', marginBottom: '32px' }}>
|
||||
{lang === 'vi' ? project.summary : project.summaryEn}
|
||||
{useField(project.summary, project.summaryEn)}
|
||||
</p>
|
||||
|
||||
{project.metrics && project.metrics.length > 0 && (
|
||||
@@ -69,8 +70,8 @@ export function ProjectDetailPage() {
|
||||
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>{strings.projectDetail.experiments[lang]}</h3>
|
||||
{project.sections.map((section, idx) => (
|
||||
<div key={idx} style={{ marginBottom: '16px', padding: '16px', background: 'var(--bg-surface)', borderRadius: '8px' }}>
|
||||
<h4 style={{ fontSize: '14px', marginBottom: '4px', color: 'var(--text-primary)' }}>{lang === 'vi' ? section.title : section.titleEn}</h4>
|
||||
<p style={{ fontSize: '14px', color: 'var(--text-secondary)' }}>{lang === 'vi' ? section.content : section.contentEn}</p>
|
||||
<h4 style={{ fontSize: '14px', marginBottom: '4px', color: 'var(--text-primary)' }}>{useField(section.title, section.titleEn)}</h4>
|
||||
<p style={{ fontSize: '14px', color: 'var(--text-secondary)' }}>{useField(section.content, section.contentEn)}</p>
|
||||
<Tag accent>{section.type}</Tag>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Badge } from '@/components/ui/Badge'
|
||||
import { projects } from '@/data/projects'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField } from '@/i18n/useField'
|
||||
|
||||
import { Link } from 'react-router'
|
||||
|
||||
@@ -10,7 +11,7 @@ export function ProjectsListPage() {
|
||||
const { lang } = useLanguage()
|
||||
return (
|
||||
<section className="section container-wide" aria-labelledby="projects-heading">
|
||||
<SectionHeading title={strings.projects.all[lang]} tag="04 - Projects" />
|
||||
<SectionHeading title={strings.projects.all[lang]} tag={strings.projects.all[lang]} />
|
||||
<div className="projects-grid">
|
||||
{projects.map((project) => (
|
||||
<Link
|
||||
@@ -24,7 +25,7 @@ export function ProjectsListPage() {
|
||||
{strings.projects.categories[project.category][lang]}
|
||||
</Badge>
|
||||
</div>
|
||||
<p className="project-card-summary">{lang === 'vi' ? project.summary : project.summaryEn}</p>
|
||||
<p className="project-card-summary">{useField(project.summary, project.summaryEn)}</p>
|
||||
<div className="project-card-techs">
|
||||
{project.technologies.slice(0, 4).map((tech) => (
|
||||
<span key={tech} className="tag">
|
||||
|
||||
Reference in new issue
Block a user