diff --git a/src/components/project/ProjectDetail.tsx b/src/components/project/ProjectDetail.tsx index 1e834f7..ab305ef 100644 --- a/src/components/project/ProjectDetail.tsx +++ b/src/components/project/ProjectDetail.tsx @@ -1,4 +1,5 @@ import Link from 'next/link' +import { getTranslations } from 'next-intl/server' import { MarkdownContent } from './MarkdownContent' import { ShareButtons } from './ShareButtons' @@ -46,6 +47,8 @@ function formatDate(date: Date | string, locale: string): string { } export async function ProjectDetail({ project, locale }: ProjectDetailProps) { + const t = await getTranslations('project') + const displayName = locale === 'en' && project.nameEn ? project.nameEn : project.name const displayDescription = locale === 'en' && project.descriptionEn ? project.descriptionEn : project.description @@ -84,7 +87,7 @@ export async function ProjectDetail({ project, locale }: ProjectDetailProps) { |
Project Preview
+{t('projectPreview')}
)} @@ -133,8 +136,8 @@ export async function ProjectDetail({ project, locale }: ProjectDetailProps) { {/* Installation section if GitHub link exists */} {project.links.some((l) => l.type === 'GITHUB') && ( <> -To install this project, clone the repository and install dependencies:
+{t('installInstructions')}
{`git clone ${
project.links.find((l) => l.type === 'GITHUB')?.url || 'https://github.com/example/project'
diff --git a/src/components/project/ProjectSidebar.tsx b/src/components/project/ProjectSidebar.tsx
index 5981804..47dac43 100644
--- a/src/components/project/ProjectSidebar.tsx
+++ b/src/components/project/ProjectSidebar.tsx
@@ -1,4 +1,5 @@
import Link from 'next/link'
+import { getTranslations } from 'next-intl/server'
interface ProjectSidebarProps {
project: {
@@ -16,23 +17,24 @@ interface ProjectSidebarProps {
locale: string
}
-// Helper function to get icon and label for link type
-function getLinkInfo(type: string): { icon: string; label: string } {
+// Helper function to get icon for link type
+function getLinkIcon(type: string): string {
switch (type.toUpperCase()) {
case 'WEBSITE':
- return { icon: 'language', label: 'Official Website' }
+ return 'language'
case 'GITHUB':
- return { icon: 'code', label: 'GitHub Repo' }
+ return 'code'
case 'HUGGINGFACE':
- return { icon: 'model_training', label: 'Hugging Face' }
+ return 'model_training'
case 'PAPER':
- return { icon: 'description', label: 'Paper' }
+ return 'description'
default:
- return { icon: 'link', label: 'External Link' }
+ return 'link'
}
}
-export function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
+export async function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
+ const t = await getTranslations('project')
const displayName = locale === 'en' && project.nameEn ? project.nameEn : project.name
return (
@@ -41,11 +43,18 @@ export function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
{project.links.length > 0 && (
- Project Links
+ {t('projectLinks')}
{project.links.map((link) => {
- const { icon, label } = getLinkInfo(link.type)
+ const icon = getLinkIcon(link.type)
+ const labelMap: Record = {
+ WEBSITE: t('officialWebsite'),
+ GITHUB: t('githubRepo'),
+ HUGGINGFACE: t('huggingface'),
+ PAPER: t('paper'),
+ }
+ const label = labelMap[link.type] || t('externalLinks')
return (
- License
+ {t('license')}
MIT
- Pricing
+ {t('pricing')}
Free
- Status
+ {t('status')}
Active
- Type
- Open Source
+ {t('type')}
+ {t('openSource')}
@@ -98,13 +107,13 @@ export function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
rocket_launch
- Build Your Own Agent?
- Start using our API to build custom agents in minutes.
+ {t('buildYourOwnAgent')}
+ {t('buildAgentDesc')}
- Get Started Now
+ {t('getStartedNow')}
@@ -113,7 +122,7 @@ export function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
{locale === 'en' && (
- On this page
+ {t('onThisPage')}
-
@@ -121,7 +130,7 @@ export function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
href="#overview"
className="text-black dark:text-white font-bold border-l-2 border-black dark:border-white -ml-[18px] pl-4 block"
>
- Overview
+ {t('overview')}
-
@@ -129,7 +138,7 @@ export function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
href="#features"
className="text-gray-600 dark:text-gray-400 hover:text-black dark:hover:text-white transition-colors block"
>
- Key Features
+ {t('keyFeatures')}
-
@@ -137,7 +146,7 @@ export function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
href="#getting-started"
className="text-gray-600 dark:text-gray-400 hover:text-black dark:hover:text-white transition-colors block"
>
- Getting Started
+ {t('gettingStarted')}
-
@@ -145,7 +154,7 @@ export function ProjectSidebar({ project, locale }: ProjectSidebarProps) {
href="#use-cases"
className="text-gray-600 dark:text-gray-400 hover:text-black dark:hover:text-white transition-colors block"
>
- Use Cases
+ {t('useCases')}
diff --git a/src/messages/en.json b/src/messages/en.json
index d73e3e6..359c75c 100644
--- a/src/messages/en.json
+++ b/src/messages/en.json
@@ -29,7 +29,25 @@
"submitYourProject": "Submit Your Project",
"submitProjectTitle": "Submit Your Project",
"submitProjectDescription": "Have an AI tool worth sharing? Add it to Agent Park.",
- "submitNow": "SUBMIT NOW"
+ "submitNow": "SUBMIT NOW",
+ "projectLinks": "Project Links",
+ "officialWebsite": "Official Website",
+ "githubRepo": "GitHub Repo",
+ "license": "License",
+ "pricing": "Pricing",
+ "status": "Status",
+ "type": "Type",
+ "openSource": "Open Source",
+ "projectPreview": "Project Preview",
+ "gettingStarted": "Getting Started",
+ "installInstructions": "To install this project, clone the repository and install dependencies:",
+ "buildYourOwnAgent": "Build Your Own Agent?",
+ "buildAgentDesc": "Start using our API to build custom agents in minutes.",
+ "getStartedNow": "Get Started Now",
+ "onThisPage": "On this page",
+ "overview": "Overview",
+ "keyFeatures": "Key Features",
+ "useCases": "Use Cases"
},
"navigation": {
"home": "Home",
diff --git a/src/messages/zh.json b/src/messages/zh.json
index 8e62449..06c1b0a 100644
--- a/src/messages/zh.json
+++ b/src/messages/zh.json
@@ -29,7 +29,25 @@
"submitYourProject": "提交你的项目",
"submitProjectTitle": "提交你的项目",
"submitProjectDescription": "有值得分享的 AI 工具吗?将其添加到 Agent Park。",
- "submitNow": "立即提交"
+ "submitNow": "立即提交",
+ "projectLinks": "项目链接",
+ "officialWebsite": "官方网站",
+ "githubRepo": "GitHub 仓库",
+ "license": "许可证",
+ "pricing": "定价",
+ "status": "状态",
+ "type": "类型",
+ "openSource": "开源",
+ "projectPreview": "项目预览",
+ "gettingStarted": "快速开始",
+ "installInstructions": "要安装此项目,请克隆仓库并安装依赖:",
+ "buildYourOwnAgent": "构建你自己的 Agent?",
+ "buildAgentDesc": "开始使用我们的 API,在几分钟内构建自定义 Agent。",
+ "getStartedNow": "立即开始",
+ "onThisPage": "本页内容",
+ "overview": "概述",
+ "keyFeatures": "核心功能",
+ "useCases": "使用场景"
},
"navigation": {
"home": "首页",