- 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
6.0 KiB
i18n Phase 1 — Code Review Feedback
Spec:
docs/design/specs/v3/spec-v3-i18n.mdDetail actions:docs/feedback/i18n-actions.md
1. Hardcoded Section Heading Tags
Severity: P1 — Visible wrong behavior on language switch.
Section number tags are hardcoded English strings instead of using the i18n string system. When user switches to Vietnamese, the title translates but the tag stays in English.
Affected files (7 locations):
| File | Line | Current | Should be |
|---|---|---|---|
src/components/sections/About.tsx |
13 | tag="01 - About" |
tag={strings.about.heading[lang]} |
src/components/sections/Expertise.tsx |
26 | tag="02 - Expertise" |
tag={strings.expertise.heading[lang]} |
src/components/sections/Experience.tsx |
26 | tag="03 - Experience" |
tag={strings.experience.heading[lang]} |
src/components/sections/Projects.tsx |
32 | tag="04 - Projects" |
tag={strings.projects.featured[lang]} |
src/pages/ProjectsListPage.tsx |
13 | tag="04 - Projects" |
tag={strings.projects.all[lang]} |
src/pages/AboutPage.tsx |
19 | tag="About" |
tag={strings.about.heading[lang]} |
src/pages/EngineeringPage.tsx |
12 | tag="Engineering" |
tag={strings.engineering.heading[lang]} |
Already correct (reference):
Contact.tsx:23—tag={\06 - ${strings.common.contactTag[lang]}`}`ExperiencePage.tsx:10—tag={strings.common.experienceTag[lang]}
Action: Replace all hardcoded tag strings with strings lookups. See i18n-actions.md for exact changes.
2. Hardcoded Language Checks (lang === 'vi')
Severity: P1 — Duplicated conditional logic, hard to maintain when adding new languages.
17 occurrences of inline lang === 'vi' ? value : valueEn pattern across 7 files. The useField() / useFieldArray() hooks already exist at src/i18n/useField.ts but are not consistently used.
Affected files:
| File | Lines | Pattern |
|---|---|---|
src/components/sections/Expertise.tsx |
43 | group.title / group.titleEn |
src/components/sections/Experience.tsx |
46, 54, 64, 73 | exp.title, exp.responsibilities, achievement.context, achievement.impact |
src/components/sections/Projects.tsx |
63 | project.summary / project.summaryEn |
src/pages/AboutPage.tsx |
62 | group.title / group.titleEn |
src/pages/ExperiencePage.tsx |
16, 24, 31, 33 | exp.title, exp.responsibilities, achievement.context, achievement.impact |
src/pages/ProjectDetailPage.tsx |
37, 72, 73 | project.summary, section.title, section.content |
src/pages/ProjectsListPage.tsx |
27 | project.summary / project.summaryEn |
Action: Replace with useField(value, valueEn) for single values or useFieldArray(arr, arrEn) for arrays. See i18n-actions.md for exact changes.
3. Duplicate DownloadResume Dropdown Logic
Severity: P2 — ~120 lines of duplicate code between Hero.tsx and DownloadResume.tsx. Diverge risk when fixing bugs.
Both files contain nearly identical implementations of:
langLabelsconstantuseEffectclick-outside listener- Lazer border wrapper structure
- Dropdown options rendering
Differences:
- Hero variant: custom CSS classes (
hero-download-dropdown,hero-download-summary),target="_blank"on links - DownloadResume variant:
DownloadButtonfallback for single-language case
Action: Extract shared DownloadResumeDropdown component with className / wrapperClassName / targetBlank props. See i18n-actions.md for design proposal.
4. Hardcoded langLabels
Severity: P3 — langLabels duplicated in 2 files. Adding a new language requires editing 2 places.
Locations:
src/components/sections/Hero.tsx:9-12src/components/sections/DownloadResume.tsx:7-10
Action: Move langLabels into src/data/resume.ts or strings.common.langLabels and import from there.
Status: All Issues Resolved
Completed: 2025-01-01
P1 — Hardcoded Section Heading Tags
Status: ✅ Resolved
All 7 SectionHeading tags now use strings lookups:
About.tsx:13→tag={strings.about.heading[lang]}Expertise.tsx:26→tag={strings.expertise.heading[lang]}Experience.tsx:26→tag={strings.experience.heading[lang]}Projects.tsx:32→tag={strings.projects.featured[lang]}ProjectsListPage.tsx:13→tag={strings.projects.all[lang]}AboutPage.tsx:19→tag={strings.about.heading[lang]}EngineeringPage.tsx:12→tag={strings.engineering.heading[lang]}
P1 — Hardcoded Language Checks
Status: ✅ Resolved
All 17 occurrences replaced with useField() / useFieldArray() hooks:
Expertise.tsx— 1 replacementExperience.tsx— 4 replacementsProjects.tsx— 1 replacementAboutPage.tsx— 1 replacementExperiencePage.tsx— 4 replacementsProjectDetailPage.tsx— 3 replacementsProjectsListPage.tsx— 1 replacement
P2 — Duplicate DownloadResume Dropdown
Status: ✅ Resolved
Extracted shared DownloadResumeDropdown component in DownloadResume.tsx with:
classNameprop for outer div customizationwrapperClassNameprop for button customizationtargetBlankprop for link target attribute
Hero.tsx now imports and uses the shared component with hero-specific props.
P3 — Hardcoded langLabels
Status: ✅ Resolved
Moved langLabels to src/data/resume.ts as resumeLanguageLabels.
Both Hero.tsx and DownloadResume.tsx now import from there.
Already Done (reference only)
These locations already follow i18n patterns correctly:
| File | Line | Pattern |
|---|---|---|
Contact.tsx |
23 | tag={\06 - ${strings.common.contactTag[lang]}`}` |
ExperiencePage.tsx |
10 | tag={strings.common.experienceTag[lang]} |
About.tsx |
16 | useField(profile.bio, profile.bioEn) |
AboutPage.tsx |
23 | useField(profile.bio, profile.bioEn) |
Expertise.tsx |
26 | title={strings.expertise.heading[lang]} |
Experience.tsx |
26 | title={strings.experience.heading[lang]} |
Projects.tsx |
32 | title={strings.projects.featured[lang]} |