MCPcopy Create free account
hub / github.com/context-space/context-space / getPathnameWithoutLocale

Function getPathnameWithoutLocale

web/src/middleware.ts:64–71  ·  view source on GitHub ↗
(pathname: string)

Source from the content-addressed store, hash-verified

62}
63
64function 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
73const handleI18nRouting = createMiddleware(routing)
74

Callers 1

middlewareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected