@mr-hope/vuepress-shared
Version:
Shared for vuepress-theme-hope
34 lines (33 loc) • 1.33 kB
TypeScript
import type { Context } from "@mr-hope/vuepress-types";
import type { HopeLang, LocaleConfig, ConvertLocaleConfig } from "./types";
/** Check if the lang is supported */
export declare const checkLang: (lang?: string) => boolean;
export declare const showLangError: (lang: string, plugin?: string) => void;
/** Get language from path */
export declare const path2Lang: (path?: string) => HopeLang;
/** Get path from language */
export declare const lang2Path: (lang?: string) => string;
/**
* Get language of root directory
*
* @param context VuePress Node Context
* @returns root language
*/
export declare const getRootLang: (context: Context) => HopeLang;
/**
* Get the infer language path from root directory language
*
* @param context VuePress Node Context
* @returns infer language
*/
export declare const getRootLangPath: (context: Context) => string;
export declare const getLocalePaths: (context: Context) => string[];
/**
* Get final locale options to passed to client
*
* @param context VuePress Node Context
* @param defaultLocalesConfig default locale config
* @param userLocalesConfig user locale config
* @returns final locale config
*/
export declare const getLocales: <T>(context: Context, defaultLocalesConfig: ConvertLocaleConfig<T>, userLocalesConfig?: LocaleConfig<T>) => ConvertLocaleConfig<T>;