silverwolf-x/project / packages /next /src /server /normalizers /locale-route-normalizer.ts
silverwolf-x's picture
download
raw
620 Bytes
import type { I18NProvider } from '../lib/i18n-provider'
import type { Normalizer } from './normalizer'
/**
* Normalizes the pathname by removing the locale prefix if any.
*/
export class LocaleRouteNormalizer implements Normalizer {
constructor(private readonly provider: I18NProvider) {}
/**
* Normalizes the pathname by removing the locale prefix if any.
*
* @param pathname The pathname to normalize.
* @returns The pathname without the locale prefix (if any).
*/
public normalize(pathname: string): string {
const match = this.provider.analyze(pathname)
return match.pathname
}
}

Xet Storage Details

Size:
620 Bytes
·
Xet hash:
ecb806209f19084f6fb384957d9e5fce24898770d2310edb03e4238c378bf092

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.