wuchale
Version:
Protobuf-like i18n from plain code
20 lines (19 loc) • 748 B
TypeScript
export type URLManifestItem = [
string,
string[]
];
export type URLManifest = URLManifestItem[];
type GetLocale = (url: URL, locales: string[]) => string | null;
export type URLLocalizer = (url: string, locale: string) => string;
export declare const localizeDefault: URLLocalizer;
export declare const getLocaleDefault: GetLocale;
type MatchParams = Partial<Record<string, string | string[]>>;
export declare const fillParams: (params: MatchParams, destPattern: string) => string;
type MatchResult = {
path: string | null;
locale: string | null;
params: MatchParams;
altPatterns: Record<string, string>;
};
export declare function URLMatcher(manifest: URLManifest, locales: string[]): (url: URL) => MatchResult;
export {};