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

27
src/pages/zh/index.astro Normal file
View File

@@ -0,0 +1,27 @@
---
import { getLangFromUrl } from "@/i18n/utils";
import Layout from "@/layouts/Layout.astro";
import GlassHeader from "@/components/GlassHeader";
import HeroSection from "@/components/HeroSection";
import ExperienceSection from "@/components/ExperienceSection";
import SkillsSection from "@/components/SkillsSection";
import ProjectsSection from "@/components/ProjectsSection";
import AwardsSection from "@/components/AwardsSection";
import EducationSection from "@/components/EducationSection";
import Footer from "@/components/Footer";
const lang = getLangFromUrl(Astro.url);
---
<Layout title="首页" lang={lang}>
<GlassHeader lang={lang} client:only="react" />
<main class="min-h-screen">
<HeroSection client:only="react" />
<ExperienceSection client:only="react" />
<SkillsSection client:only="react" />
<ProjectsSection client:only="react" />
<AwardsSection client:only="react" />
<EducationSection client:only="react" />
</main>
<Footer lang={lang} client:only="react" />
</Layout>