update
Some checks failed
deploy / deploy (push) Has been cancelled

This commit is contained in:
toom1996
2026-08-22 20:47:03 +08:00
parent 0df14036cf
commit c8d9735751
20 changed files with 228 additions and 125 deletions

View File

@ -8,13 +8,6 @@ export const DEFAULT_LOCALE = 'en' as const;
export const LOCALES = ['en', 'cn'] as const;
export type Locale = (typeof LOCALES)[number];
/**
* 默认语言是否带 URL 前缀:
* - false → 英文在根路径(/shows),中文在 /cn/shows(本项目采用)
* - true → 所有语言都带前缀(/en/shows、/cn/shows)
*/
export const PREFIX_DEFAULT_LOCALE = false;
/** 语言显示名(用于语言切换器等 UI)。 */
export const LOCALE_NAMES: Record<Locale, string> = {
en: 'English',
@ -29,8 +22,3 @@ export const BROWSER_LOCALE_MAP: Record<string, Locale> = {
'zh-hk': 'cn',
'en': 'en',
};
/** 判断一个路径段是不是已支持的语言前缀。 */
export function isLocaleSegment(seg: string | undefined): seg is Locale {
return !!seg && (LOCALES as readonly string[]).includes(seg);
}