Files
frontend_v2/src/i18n/config.ts
toom1996 52ad7497e8
Some checks failed
deploy / deploy (push) Has been cancelled
update
2026-08-23 22:26:37 +08:00

31 lines
1009 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// i18n 核心配置:语言列表、默认语言、URL 前缀规则
// 改这里即可增减语言;新增语言记得同步 src/i18n/dictionary.ts 里的每个 key(单文件聚合多语言)。
/** 默认语言(无前缀时使用的语言,如 /shows)。 */
export const DEFAULT_LOCALE = 'en' as const;
/** 支持的语言列表。URL 前缀用的就是这些值,例如 /cn/shows 的 `cn`。 */
export const LOCALES = ['en', 'cn'] as const;
export type Locale = (typeof LOCALES)[number];
/** 语言显示名(用于语言切换器等 UI)。 */
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> = {
'zh': 'cn',
'zh-cn': 'cn',
'zh-tw': 'cn',
'zh-hk': 'cn',
'en': 'en',
};