- 将客户端组件改为服务端组件,使用 getTranslations - LocaleSwitcher 简化为接收 switchUrl prop - ProjectCard/ProjectList/ExternalLinkCard 等组件支持 i18n - 优化 webhook 去重查询,关联 links 数据 - 移除 ProjectDetail 中的客户端交互逻辑(ShareButtons 暂时禁用) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
544 B
TypeScript
23 lines
544 B
TypeScript
'use client'
|
|
|
|
import Link from 'next/link'
|
|
|
|
const locales = ['zh', 'en'] as const
|
|
const localeNames: Record<string, string> = {
|
|
zh: '中文',
|
|
en: 'EN'
|
|
}
|
|
|
|
export function LocaleSwitcher({ currentLocale, switchUrl }: { currentLocale: string; switchUrl: string }) {
|
|
const otherLocale = currentLocale === 'zh' ? 'en' : 'zh'
|
|
|
|
return (
|
|
<Link
|
|
href={switchUrl}
|
|
className="font-display text-sm font-bold hover:opacity-70 transition-opacity"
|
|
>
|
|
{localeNames[currentLocale]} / {localeNames[otherLocale]}
|
|
</Link>
|
|
)
|
|
}
|