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:
@@ -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">
|
<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">
|
<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>
|
</h1>
|
||||||
<p className="text-lg md:text-xl text-gray-600 dark:text-gray-300 mb-10 max-w-2xl mx-auto font-sans">
|
<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>
|
</p>
|
||||||
<Suspense fallback={<div className="h-16"></div>}>
|
<Suspense fallback={<div className="h-16"></div>}>
|
||||||
<SearchBar
|
<SearchBar
|
||||||
@@ -45,7 +45,7 @@ export default async function HomePage({ params }: HomePageProps) {
|
|||||||
{/* Browse by Tags Section */}
|
{/* Browse by Tags Section */}
|
||||||
<section className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16">
|
<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">
|
<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>
|
</h2>
|
||||||
<TagCloud tags={tags} locale={locale} />
|
<TagCloud tags={tags} locale={locale} />
|
||||||
</section>
|
</section>
|
||||||
@@ -53,16 +53,16 @@ export default async function HomePage({ params }: HomePageProps) {
|
|||||||
{/* Featured Projects Section */}
|
{/* Featured Projects Section */}
|
||||||
<section className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pb-24">
|
<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">
|
<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`}>
|
<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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<ProjectList projects={projectsData.projects} locale={locale} featured />
|
<ProjectList projects={projectsData.projects} locale={locale} featured />
|
||||||
|
|
||||||
<div className="mt-8 text-center md:hidden">
|
<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`}>
|
<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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { notFound } from 'next/navigation'
|
import { notFound } from 'next/navigation'
|
||||||
|
import { getTranslations } from 'next-intl/server'
|
||||||
import { getProjectBySlug, getProjects } from '@/hooks/useProjects'
|
import { getProjectBySlug, getProjects } from '@/hooks/useProjects'
|
||||||
import { ProjectDetail } from '@/components/project/ProjectDetail'
|
import { ProjectDetail } from '@/components/project/ProjectDetail'
|
||||||
import { ProjectSidebar } from '@/components/project/ProjectSidebar'
|
import { ProjectSidebar } from '@/components/project/ProjectSidebar'
|
||||||
@@ -13,6 +14,7 @@ export default async function ProjectDetailPage({
|
|||||||
}: ProjectDetailPageProps) {
|
}: ProjectDetailPageProps) {
|
||||||
const resolvedParams = await params
|
const resolvedParams = await params
|
||||||
const { locale, id } = resolvedParams
|
const { locale, id } = resolvedParams
|
||||||
|
const tProject = await getTranslations('project')
|
||||||
|
|
||||||
// Get project by slug
|
// Get project by slug
|
||||||
const project = await getProjectBySlug(id)
|
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">
|
<span className="material-icons text-base mr-1 group-hover:-translate-x-1 transition-transform">
|
||||||
arrow_back
|
arrow_back
|
||||||
</span>
|
</span>
|
||||||
BACK TO PROJECTS
|
{tProject('backToProjects')}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,17 @@
|
|||||||
"browseByTag": "Browse by Tag",
|
"browseByTag": "Browse by Tag",
|
||||||
"searchPlaceholder": "Search AI projects...",
|
"searchPlaceholder": "Search AI projects...",
|
||||||
"metaTitle": "Agent Park - AI Project Navigator",
|
"metaTitle": "Agent Park - AI Project Navigator",
|
||||||
"metaDescription": "Discover and explore quality AI projects from across the web"
|
"metaDescription": "Discover and explore quality AI projects from across the web",
|
||||||
|
"heroTitle": "AI PROJECT",
|
||||||
|
"heroTitle2": "NAVIGATOR",
|
||||||
|
"heroDescription": "Discover and explore high-quality AI projects from across the web. Curated for developers and enthusiasts.",
|
||||||
|
"browseByTagsSection": "BROWSE BY TAGS",
|
||||||
|
"featuredProjectsSection": "FEATURED PROJECTS",
|
||||||
|
"viewAll": "VIEW ALL",
|
||||||
|
"viewAllProjects": "VIEW ALL PROJECTS"
|
||||||
},
|
},
|
||||||
"project": {
|
"project": {
|
||||||
|
"backToProjects": "BACK TO PROJECTS",
|
||||||
"details": "Project Details",
|
"details": "Project Details",
|
||||||
"externalLinks": "External Links",
|
"externalLinks": "External Links",
|
||||||
"viewProject": "View Project",
|
"viewProject": "View Project",
|
||||||
|
|||||||
@@ -15,9 +15,17 @@
|
|||||||
"browseByTag": "按标签浏览",
|
"browseByTag": "按标签浏览",
|
||||||
"searchPlaceholder": "搜索 AI 项目...",
|
"searchPlaceholder": "搜索 AI 项目...",
|
||||||
"metaTitle": "Agent Park - AI 项目导航",
|
"metaTitle": "Agent Park - AI 项目导航",
|
||||||
"metaDescription": "发现和探索全网优质 AI 项目"
|
"metaDescription": "发现和探索全网优质 AI 项目",
|
||||||
|
"heroTitle": "AI 项目",
|
||||||
|
"heroTitle2": "导航",
|
||||||
|
"heroDescription": "发现和探索来自全网的高质量 AI 项目。为开发者和爱好者精心策划。",
|
||||||
|
"browseByTagsSection": "按标签浏览",
|
||||||
|
"featuredProjectsSection": "精选项目",
|
||||||
|
"viewAll": "查看全部",
|
||||||
|
"viewAllProjects": "查看全部项目"
|
||||||
},
|
},
|
||||||
"project": {
|
"project": {
|
||||||
|
"backToProjects": "返回项目列表",
|
||||||
"details": "项目详情",
|
"details": "项目详情",
|
||||||
"externalLinks": "外部链接",
|
"externalLinks": "外部链接",
|
||||||
"viewProject": "查看项目",
|
"viewProject": "查看项目",
|
||||||
|
|||||||
Reference in New Issue
Block a user