(pathname: string)
| 62 | } |
| 63 | |
| 64 | function getPathnameWithoutLocale(pathname: string): string { |
| 65 | // 移除语言前缀 (如 /zh, /en) |
| 66 | const segments = pathname.split("/").filter(Boolean) |
| 67 | if (segments.length > 0 && locales.includes(segments[0] as Locale)) { |
| 68 | return `/${segments.slice(1).join("/")}` |
| 69 | } |
| 70 | return pathname |
| 71 | } |
| 72 | |
| 73 | const handleI18nRouting = createMiddleware(routing) |
| 74 |