@ -9,10 +9,16 @@ export const LOCALES = ['en', 'cn'] as const;
|
||||
export type Locale = (typeof LOCALES)[number];
|
||||
|
||||
/** 语言显示名(用于语言切换器等 UI)。 */
|
||||
export const LOCALE_NAMES: Record<Locale, string> = {
|
||||
en: 'English',
|
||||
cn: '中文',
|
||||
};
|
||||
export const LOCALE_NAMES: Record<string, { name: string; nativeName: string }> = {
|
||||
cn: {
|
||||
name: '中文',
|
||||
nativeName: '中文',
|
||||
},
|
||||
en: {
|
||||
name: 'English',
|
||||
nativeName: 'English',
|
||||
},
|
||||
} as const;
|
||||
|
||||
/** 浏览器 Accept-Language / navigator.language → 本项目支持的语言。 */
|
||||
export const BROWSER_LOCALE_MAP: Record<string, Locale> = {
|
||||
|
||||
@ -20,7 +20,7 @@ type TranslationEntry = Partial<Record<OtherLocale, string>>;
|
||||
export const dict: Record<string, TranslationEntry> = {
|
||||
// ── 导航 / Navigation ──
|
||||
'About': { cn: '关于' },
|
||||
'All Shows': { cn: '全部走秀' },
|
||||
'全部的 runway': { cn: '全部的 runway' },
|
||||
'Contact': { cn: '联系' },
|
||||
'Contact Us': { cn: '联系我们' },
|
||||
'Home': { cn: '首页' },
|
||||
@ -47,6 +47,23 @@ export const dict: Record<string, TranslationEntry> = {
|
||||
// ── 页脚 / Footer ──
|
||||
'© 2026 PORTFOLIO STUDIO. ALL RIGHTS RESERVED.': { cn: '© 2026 PORTFOLIO STUDIO. 保留所有权利。' },
|
||||
|
||||
// ── 页脚工具 / Footer tools ──
|
||||
'Color Studio Tools': { cn: '色彩工作室工具' },
|
||||
'AI Color Trend Generator': { cn: 'AI 色彩趋势生成器' },
|
||||
'Photo Swatch Extractor': { cn: '图片色板提取器' },
|
||||
'Upload': { cn: '上传' },
|
||||
'Reset B&W Theme': { cn: '重置黑白主题' },
|
||||
'Default': { cn: '默认' },
|
||||
|
||||
// ── 页脚简介 / Manifesto ──
|
||||
'Minimalist editorial portfolio documenting haute couture shows, backstage fittings, and street culture. Integrated with 2026 color forecast intelligence and AI palette generator.':
|
||||
{ cn: '极简编辑风格作品集,记录高级定制秀场、后台试装与街头文化。集成 2026 色彩预测情报与 AI 调色板生成器。' },
|
||||
|
||||
// ── 登录态 / Auth ──
|
||||
'Hi': { cn: '你好' },
|
||||
'Logout': { cn: '退出' },
|
||||
'Language': { cn: '语言' },
|
||||
|
||||
'Runway looks': {cn: '秀场造型'}
|
||||
};
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@ export function getLocaleFromUrl(url: URL | string): Locale {
|
||||
|
||||
/**
|
||||
* 取翻译函数 t():key 即英文原文,按当前语言自动匹配翻译。
|
||||
* - 英文环境:t('All Shows') 直接返回 'All Shows'(key 本身)
|
||||
* - 中文环境:t('All Shows') 返回字典里的 '全部走秀'(取不到则回退英文)
|
||||
* - 英文环境:t('全部的 runway') 直接返回 '全部的 runway'(key 本身)
|
||||
* - 中文环境:t('全部的 runway') 返回字典里的 '全部的 runway'(取不到则回退英文)
|
||||
* - 支持 {name} 形式的插值参数。
|
||||
*/
|
||||
export function useTranslations(locale: Locale) {
|
||||
|
||||
Reference in New Issue
Block a user