feat(i18n): implement internationalization support for en and zh

Add i18n infrastructure with translation files and utility functions
Update components to use translations and language switching
Create localized pages for en and zh languages
Add language detection and path localization utilities
This commit is contained in:
joyzhao
2025-06-15 09:08:41 +08:00
parent 4ab809ed94
commit ee0fbcceb2
9 changed files with 470 additions and 450 deletions

32
src/i18n/ui.ts Normal file
View File

@@ -0,0 +1,32 @@
// src/i18n/ui.ts
export const languages = {
en: 'English',
zh: '简体中文',
} as const;
export const defaultLang = 'en';
export const ui = {
en: {
'nav.home': 'Home',
'nav.projects': 'Projects',
'nav.experience': 'Experience',
'nav.skills': 'Skills',
'nav.awards': 'Awards',
'nav.education': 'Education',
'footer.rights': 'All rights reserved.',
'site.title': 'My Portfolio',
// 根据您的项目实际情况添加更多翻译键值对
},
zh: {
'nav.home': '首页',
'nav.projects': '项目经历',
'nav.experience': '工作经历',
'nav.skills': '专业技能',
'nav.awards': '奖项荣誉',
'nav.education': '教育背景',
'footer.rights': '版权所有。',
'site.title': '我的作品集',
// 根据您的项目实际情况添加更多翻译键值对
},
} as const;