From a446ce68bd089c9492d1d9273dabb40a98cee65d Mon Sep 17 00:00:00 2001 From: joyzhao Date: Fri, 20 Jun 2025 10:49:53 +0800 Subject: [PATCH] feat(i18n): add slogans and update translations for multiple pages Add new slogan translations for projects and blog pages in both English and Chinese Update about and services pages with additional content Modify footer to include remote work availability notice --- src/components/Footer.tsx | 20 ++++++++++++++------ src/i18n/ui.ts | 8 ++++++++ src/pages/about.md | 2 ++ src/pages/blog/index.astro | 5 +++-- src/pages/projects.astro | 2 +- src/pages/services.md | 2 ++ src/pages/zh/blog/index.astro | 5 +++-- 7 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index d2b6740..eb07678 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -29,12 +29,20 @@ export default function Footer({ lang: propLang }: FooterProps) { transition={{ duration: 0.5 }} viewport={{ once: true }} > - - © {new Date().getFullYear()} { personalInfo.name }. {t('footer.rights')} ✨ - + + + © {new Date().getFullYear()} { personalInfo.name }. {t('footer.rights')} ✨ + + + {lang === 'zh' ? '如果你正在寻找一名前端/Ts全栈工程师(远程工作),请联系我!' : 'Looking for a Frontend/TS Full-stack Engineer (Remote)? Contact me!'} + + Latest Blog

- Dive into my thoughts on coding, tech trends, and developer life. Explore my latest posts below. + {t('blog.slogan')} Dive into my thoughts on coding, tech trends, and developer life. Explore my latest posts below.

diff --git a/src/pages/projects.astro b/src/pages/projects.astro index 0a16280..aab4d77 100644 --- a/src/pages/projects.astro +++ b/src/pages/projects.astro @@ -33,7 +33,7 @@ const currentProjects = projects[lang as keyof typeof projects] || projects.en;

- {t('projects.description')} + {t('projects.slogan')} {t('projects.description')}

diff --git a/src/pages/services.md b/src/pages/services.md index 750241c..ac97d03 100644 --- a/src/pages/services.md +++ b/src/pages/services.md @@ -6,6 +6,8 @@ layout: "../layouts/AboutLayout.astro" # Services I Provide 🛠️ +用优雅的代码和创新的思维,为复杂问题打造精致的解决方案。 + ## Web Development 🌐 - Building responsive and modern websites using the latest technologies diff --git a/src/pages/zh/blog/index.astro b/src/pages/zh/blog/index.astro index c261211..ae06efb 100644 --- a/src/pages/zh/blog/index.astro +++ b/src/pages/zh/blog/index.astro @@ -5,12 +5,13 @@ import CategoryCard from '../../../components/blog/CategoryCard.astro'; import TagCard from '../../../components/blog/TagCard.astro'; import Container from '../../../components/ui/Container'; import { type BlogPost } from '@/types'; -import { type Lang } from '@/i18n/utils'; +import { type Lang, useTranslations } from '@/i18n/utils'; import { defaultLang } from '@/i18n/ui'; import { sortPostsByDate, extractCategories, extractTags } from '@/utils/blog-utils'; // 使用Astro.currentLocale获取当前语言环境 const lang = Astro.currentLocale as Lang || defaultLang; +const t = useTranslations(lang); // 使用import.meta.glob读取所有中文博客文章 const allPosts = await import.meta.glob('./posts/*.md', { eager: true }); @@ -62,7 +63,7 @@ const tags = extractTags(allPostsArray); 我的博客

- 深入我对编程、技术趋势和开发者生活的思考。探索我的最新文章。 + {t('blog.slogan')} 探索我对网络开发、设计和技术的想法、教程和见解。