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

View File

@@ -1,4 +1,5 @@
---
import { getLangFromUrl } from "@/i18n/utils";
import Layout from "@/layouts/Layout.astro";
import GlassHeader from "@/components/GlassHeader";
import HeroSection from "@/components/HeroSection";
@@ -8,10 +9,12 @@ 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>
<GlassHeader client:only="react" />
<Layout title="Home" lang={lang}>
<GlassHeader lang={lang} client:only="react" />
<main class="min-h-screen">
<HeroSection client:only="react" />
<ExperienceSection client:only="react" />
@@ -20,5 +23,5 @@ import Footer from "@/components/Footer";
<AwardsSection client:only="react" />
<EducationSection client:only="react" />
</main>
<Footer client:only="react" />
<Footer lang={lang} client:only="react" />
</Layout>