fix: 完善首页和详情页国际化实现

- 首页 hero 区域标题和描述使用 i18n 翻译
- 首页 "BROWSE BY TAGS" 和 "FEATURED PROJECTS" 使用 i18n 翻译
- 详情页 "BACK TO PROJECTS" 使用 i18n 翻译
- 添加缺失的中英文翻译键

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-30 19:57:07 +08:00
co-authored by Claude
parent 5e43a7d382
commit 4b0770fe44
4 changed files with 27 additions and 9 deletions
+6 -6
View File
@@ -28,10 +28,10 @@ export default async function HomePage({ params }: HomePageProps) {
<section className="max-w-4xl mx-auto px-4 py-20 text-center relative z-10">
<h1 className="font-display text-5xl md:text-7xl font-bold mb-6 tracking-tight leading-tight">
AI PROJECT <br className="hidden md:block" />NAVIGATOR
{t('heroTitle')} <br className="hidden md:block" />{t('heroTitle2')}
</h1>
<p className="text-lg md:text-xl text-gray-600 dark:text-gray-300 mb-10 max-w-2xl mx-auto font-sans">
Discover and explore high-quality AI projects from across the web. Curated for developers and enthusiasts.
{t('heroDescription')}
</p>
<Suspense fallback={<div className="h-16"></div>}>
<SearchBar
@@ -45,7 +45,7 @@ export default async function HomePage({ params }: HomePageProps) {
{/* Browse by Tags Section */}
<section className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16">
<h2 className="font-display text-xl font-bold mb-6 border-b-2 border-black dark:border-gray-700 pb-2 inline-block">
BROWSE BY TAGS
{t('browseByTagsSection')}
</h2>
<TagCloud tags={tags} locale={locale} />
</section>
@@ -53,16 +53,16 @@ export default async function HomePage({ params }: HomePageProps) {
{/* Featured Projects Section */}
<section className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pb-24">
<div className="flex items-end justify-between mb-8">
<h2 className="font-display text-3xl font-bold">FEATURED PROJECTS</h2>
<h2 className="font-display text-3xl font-bold">{t('featuredProjectsSection')}</h2>
<a className="hidden md:flex items-center font-display text-sm font-bold hover:underline" href={`/${locale}/projects`}>
VIEW ALL <span className="ml-1"></span>
{t('viewAll')} <span className="ml-1"></span>
</a>
</div>
<ProjectList projects={projectsData.projects} locale={locale} featured />
<div className="mt-8 text-center md:hidden">
<a className="inline-flex items-center font-display text-sm font-bold border-b-2 border-black dark:border-white pb-1" href={`/${locale}/projects`}>
VIEW ALL PROJECTS <span className="ml-1"></span>
{t('viewAllProjects')} <span className="ml-1"></span>
</a>
</div>
</section>
+3 -1
View File
@@ -1,4 +1,5 @@
import { notFound } from 'next/navigation'
import { getTranslations } from 'next-intl/server'
import { getProjectBySlug, getProjects } from '@/hooks/useProjects'
import { ProjectDetail } from '@/components/project/ProjectDetail'
import { ProjectSidebar } from '@/components/project/ProjectSidebar'
@@ -13,6 +14,7 @@ export default async function ProjectDetailPage({
}: ProjectDetailPageProps) {
const resolvedParams = await params
const { locale, id } = resolvedParams
const tProject = await getTranslations('project')
// Get project by slug
const project = await getProjectBySlug(id)
@@ -43,7 +45,7 @@ export default async function ProjectDetailPage({
<span className="material-icons text-base mr-1 group-hover:-translate-x-1 transition-transform">
arrow_back
</span>
BACK TO PROJECTS
{tProject('backToProjects')}
</a>
</div>