Files
awoooi/apps/web/src/i18n/routing.ts
OG T 196d269b92 feat: add all application source code
- apps/api: FastAPI backend with Dockerfile
- apps/web: Next.js frontend with Dockerfile
- apps/sensor: Signal collection agent
- packages: shared packages

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-22 18:57:44 +08:00

36 lines
879 B
TypeScript

import { defineRouting } from 'next-intl/routing'
import { createNavigation } from 'next-intl/navigation'
// 定義路由配置
export const routing = defineRouting({
// 支援的語系列表
locales: ['zh-TW', 'en'],
// 預設語系 (繁體中文)
defaultLocale: 'zh-TW',
// 永遠顯示語系前綴
localePrefix: 'always',
})
// 匯出導航工具
export const { Link, redirect, usePathname, useRouter, getPathname } =
createNavigation(routing)
// 匯出類型
export type Locale = (typeof routing.locales)[number]
export const locales = routing.locales
export const defaultLocale = routing.defaultLocale
// 語系名稱對照
export const localeNames: Record<Locale, string> = {
'zh-TW': '繁體中文',
en: 'English',
}
// 語系短名稱 (用於切換器)
export const localeShortNames: Record<Locale, string> = {
'zh-TW': '繁中',
en: 'EN',
}