@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user