Files
sage-home/i18n/routing.ts
砂糖 99ce2b7fb8 feat: 更新网站配置和内容,优化国际化设置
refactor: 重构产线页面和路由,移除无用代码
style: 调整内容格式和样式,统一中英文标点
docs: 更新产品描述和元数据,完善多语言支持
2026-01-26 16:22:07 +08:00

37 lines
875 B
TypeScript

import { createNavigation } from 'next-intl/navigation';
import { defineRouting } from 'next-intl/routing';
export const LOCALES = ['zh', 'en']
export const DEFAULT_LOCALE = 'zh'
export const LOCALE_NAMES: Record<string, string> = {
'en': "English",
'zh': "中文",
// 'vi': "Tiếng Việt",
};
export const routing = defineRouting({
// A list of all locales that are supported
locales: LOCALES,
// Used when no locale matches
defaultLocale: DEFAULT_LOCALE,
// auto detect locale
localeDetection: process.env.NEXT_PUBLIC_LOCALE_DETECTION === 'true',
localePrefix: 'always',
});
// Lightweight wrappers around Next.js' navigation APIs
// that will consider the routing configuration
export const {
Link,
redirect,
usePathname,
useRouter,
getPathname,
} = createNavigation(routing);
export type Locale = (typeof routing.locales)[number];