next-translate-routes-multi-domain
Version:
Flexible and translated routes for Next.js without custom server
21 lines (20 loc) • 664 B
TypeScript
import { UrlObject } from 'url';
import type { TRouteBranch } from '../types';
/**
* Get path pattern (path-to-regexp synthax) from file path parts
*
* Ex: `/[dynamic]/path` => `/:dynamic/path`
*/
export declare const getTranslatedPathPattern: ({ routeBranch, pathParts, locale, }: {
routeBranch: TRouteBranch;
/** Remaining path parts after the `routeBranch` path parts */
pathParts: string[];
locale: string;
}) => string;
/**
* Translate Next file url into translated string url
*
* @param url Next default file url
* @param locale string
*/
export declare const fileUrlToUrl: (url: UrlObject | URL | string, locale: string) => string;