mirror of
https://github.com/vercel/flags.git
synced 2026-09-19 03:49:23 +08:00
15 lines
456 B
TypeScript
15 lines
456 B
TypeScript
import { getPublicPath } from "@vercel/geistdocs/config";
|
|
import { localizeHref } from "@vercel/geistdocs/localize-href";
|
|
import { config } from "./config";
|
|
|
|
export const getLocalizedPath = (lang: string | undefined, path: string) => {
|
|
const defaultLanguage = config.defaultLanguage ?? "en";
|
|
const localizedPath = localizeHref(
|
|
path,
|
|
lang ?? defaultLanguage,
|
|
defaultLanguage
|
|
);
|
|
|
|
return getPublicPath(localizedPath, config.basePath);
|
|
};
|