Skip to content

@i18n-micro/vitepress

56 exports across 4 entry points. Generated from the API snapshot that pnpm run api:surface checks against the TypeScript sources.

@i18n-micro/vitepress

ts
import { /* … */ } from '@i18n-micro/vitepress'
ExportKindSignature
CleanTranslationtypestring | number | boolean | Translations | PluralTranslations | null
createI18nfunction(options: CreateI18nOptions) => CreateI18nResult
CreateI18nOptionsinterface12 members
CreateI18nResulttypeI18nPlugin & PathMethods & { /** Same as `.global` (VueI18n + path methods). */ i18n: I18nPlugin['global'] & PathMethods enhanceApp: (ctx: { app: App; router: VitePressRouterLike; siteData?: Ref<VitePressSiteDataLike> | VitePressSiteDataLike }) => void }
defaultPluralconstPluralFunc
FormatServiceclass19 members
getLocaleFromPathfunction(path: string, localeCodes: string[], defaultLocale: string, localeKeyToCode?: Record<string, string>, base?: string) => string
Gettertype(key: TranslationKey, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown
I18nGroupconstDefineComponent<I18nGroupProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<I18nGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>
I18nLinkconstDefineComponent<ExtractPropTypes<{ to: { type: PropType<string | { path?: string; }>; required: true; }; activeStyle: { type: PropType<CSSProperties>; default: () => {}; }; localeRoute: { type: PropType<(to: string | { path?: string; }, locale?: string) => string | { path?: string; }>; default: undefined; }; }>, () => VNode<RendererNode, RendererElement, { [key: string]: any; }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<{ to: { type: PropType<string | { path?: string; }>; required: true; }; activeStyle: { type: PropType<CSSProperties>; default: () => {}; }; localeRoute: { type: PropType<(to: string | { path?: string; }, locale?: string) => string | { path?: string; }>; default: undefined; }; }>> & Readonly<{}>, { activeStyle: CSSProperties; localeRoute: (to: string | { path?: string; }, locale?: string) => string | { path?: string; }; }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>
I18nPlugintypePlugin_2 & { global: VueI18n; setRoutingStrategy: (strategy: I18nRoutingStrategy) => void; }
I18nRoutingStrategyinterface6 members
I18nSwitcherconstDefineComponent<ExtractPropTypes<{ customLabels: { type: PropType<Record<string, string>>; default: () => {}; }; customWrapperStyle: { type: PropType<CSSProperties>; default: () => {}; }; customButtonStyle: { type: PropType<CSSProperties>; default: () => {}; }; customDropdownStyle: { type: PropType<CSSProperties>; default: () => {}; }; customItemStyle: { type: PropType<CSSProperties>; default: () => {}; }; customLinkStyle: { type: PropType<CSSProperties>; default: () => {}; }; customActiveLinkStyle: { type: PropType<CSSProperties>; default: () => {}; }; customDisabledLinkStyle: { type: PropType<CSSProperties>; default: () => {}; }; customIconStyle: { type: PropType<CSSProperties>; default: () => {}; }; locales: { type: PropType<Locale[]>; default: undefined; }; currentLocale: { type: PropType<string | (() => string)>; default: undefined; }; getLocaleName: { type: PropType<() => string | null>; default: undefined; }; switchLocale: { type: PropType<(locale: string) => void>; default: undefined; }; localeRoute: { type: PropType<(to: string | { path?: string; }, locale?: string) => string | { path?: string; }>; default: undefined; }; }>, () => VNode<RendererNode, RendererElement, { [key: string]: any; }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<{ customLabels: { type: PropType<Record<string, string>>; default: () => {}; }; customWrapperStyle: { type: PropType<CSSProperties>; default: () => {}; }; customButtonStyle: { type: PropType<CSSProperties>; default: () => {}; }; customDropdownStyle: { type: PropType<CSSProperties>; default: () => {}; }; customItemStyle: { type: PropType<CSSProperties>; default: () => {}; }; customLinkStyle: { type: PropType<CSSProperties>; default: () => {}; }; customActiveLinkStyle: { type: PropType<CSSProperties>; default: () => {}; }; customDisabledLinkStyle: { type: PropType<CSSProperties>; default: () => {}; }; customIconStyle: { type: PropType<CSSProperties>; default: () => {}; }; locales: { type: PropType<Locale[]>; default: undefined; }; currentLocale: { type: PropType<string | (() => string)>; default: undefined; }; getLocaleName: { type: PropType<() => string | null>; default: undefined; }; switchLocale: { type: PropType<(locale: string) => void>; default: undefined; }; localeRoute: { type: PropType<(to: string | { path?: string; }, locale?: string) => string | { path?: string; }>; default: undefined; }; }>> & Readonly<{}>, { localeRoute: (to: string | { path?: string; }, locale?: string) => string | { path?: string; }; customLabels: Record<string, string>; customWrapperStyle: CSSProperties; customButtonStyle: CSSProperties; customDropdownStyle: CSSProperties; customItemStyle: CSSProperties; customLinkStyle: CSSProperties; customActiveLinkStyle: CSSProperties; customDisabledLinkStyle: CSSProperties; customIconStyle: CSSProperties; locales: Locale[]; currentLocale: string | (() => string); getLocaleName: () => string | null; switchLocale: (locale: string) => void; }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>
I18nTconstDefineComponent<ExtractPropTypes<{ keypath: { type: PropType<TranslationKey>; required: true; }; plural: { type: PropType<number | string>; }; tag: { type: PropType<string>; default: string; }; params: { type: PropType<Record<string, string | number | boolean>>; default: () => {}; }; defaultValue: { type: PropType<string>; default: string; }; html: { type: PropType<boolean>; default: boolean; }; hideIfEmpty: { type: PropType<boolean>; default: boolean; }; customPluralRule: { type: PropType<PluralFunc>; default: null; }; number: { type: PropType<number | string>; }; date: { type: PropType<Date | string | number>; }; relativeDate: { type: PropType<Date | string | number>; }; }>, () => string | VNode<RendererNode, RendererElement, { [key: string]: any; }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<{ keypath: { type: PropType<TranslationKey>; required: true; }; plural: { type: PropType<number | string>; }; tag: { type: PropType<string>; default: string; }; params: { type: PropType<Record<string, string | number | boolean>>; default: () => {}; }; defaultValue: { type: PropType<string>; default: string; }; html: { type: PropType<boolean>; default: boolean; }; hideIfEmpty: { type: PropType<boolean>; default: boolean; }; customPluralRule: { type: PropType<PluralFunc>; default: null; }; number: { type: PropType<number | string>; }; date: { type: PropType<Date | string | number>; }; relativeDate: { type: PropType<Date | string | number>; }; }>> & Readonly<{}>, { html: boolean; tag: string; params: Record<string, string | number | boolean>; defaultValue: string; hideIfEmpty: boolean; customPluralRule: PluralFunc; }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>
interpolatefunction(template: string, params: Params) => string
Localeinterface11 members
LocaleCodetypestring
messagesFromGlobfunction(modules: Record<string, { default: Translations; } | Translations>) => Record<string, Translations>
ParamstypeRecord<string, string | number | boolean>
PathMethodstypePick< VitePressRouterAdapter, 'localizePath' | 'switchLocalePath' | 'getLocaleFromPath' | 'removeLocaleFromPath' | 'routeNameFromPath' >
PluralFunctype(key: TranslationKey, count: number, params: Params, locale: string, getter: Getter) => string | null
routeNameFromPathfunction(path: string, localeCodes: string[], defaultLocale?: string, localeKeyToCode?: Record<string, string>, base?: string) => string
stripSiteBasefunction(path: string, base?: string) => string
Translationsinterface1 members
useI18nfunction(options?: UseI18nOptions) => { instance: VueI18n; locale: WritableComputedRef<string, string>; getLocales: () => Locale[]; defaultLocale: () => string; getLocaleName: () => string | null; localeRoute: (to: string | { path?: string; }, localeCode?: string) => string | { path?: string; }; localePath: (to: string | { path?: string; }, locale?: string) => string; switchLocale: (newLocale: string) => void; t: (key: TranslationKey, params?: Params, defaultValue?: string | null, routeContext?: unknown) => CleanTranslation; ts: (key: TranslationKey, params?: Params, defaultValue?: string, routeContext?: unknown) => string; tc: (key: TranslationKey, count: number | Params, defaultValue?: string) => string; tn: { (value: number, options?: Intl.NumberFormatOptions): string; (value: number, key: string, overrides?: Intl.NumberFormatOptions): string; (value: number, key: string, locale: string, overrides?: Intl.NumberFormatOptions): string; }; td: { (value: Date | number | string, options?: Intl.DateTimeFormatOptions): string; (value: Date | number | string, key: string, overrides?: Intl.DateTimeFormatOptions): string; (value: Date | number | string, key: string, locale: string, overrides?: Intl.DateTimeFormatOptions): string; }; tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string; has: (key: TranslationKey, routeContext?: unknown) => boolean; resolveTranslations: (routeContext?: unknown) => Translations; setTranslation: (key: TranslationKey, value: unknown) => void; setRoute: (routeName: string) => void; getRoute: () => string; getLocale: () => string; addTranslations: (locale: string, translations: Translations, merge?: boolean) => void; addRouteTranslations: (locale: string, routeName: string, translations: Translations, merge?: boolean) => void; mergeTranslations: (locale: string, routeName: string, translations: Translations) => void; clearCache: () => void; }
UseI18nOptionsinterface2 members
VirtualI18nConfiginterface10 members
VitePressSiteDataLikeinterface1 members
VitePressUserConfigLikeinterface7 members
VueI18nOptionsinterface6 members
WithI18nOptionsinterface20 members
CreateI18nOptions — 12 members
MemberType
base?string | undefined
defaultLocale?string | undefined
fallbackLocale?string | undefined
localestring
localeKeyToCode?Record<string, string> | undefined
locales?Locale[] | undefined
messages?Record<string, Translations> | undefined
missingHandler?((locale: string, key: string, routeName: string) => void) | undefined
missingWarn?boolean | undefined
plural?PluralFunc | undefined
routeMessages?Record<string, Record<string, Translations>> | undefined
syncWithVitePress?boolean | undefined
FormatService — 19 members, identical to [`FormatService`](/api/packages/astro).
I18nRoutingStrategy — 6 members
MemberType
getCurrentPath() => string
getRoute?(() => { fullPath: string; query: Record<string, unknown>; }) | undefined
linkComponent?string | Component | undefined
push(target: { path: string; }) => void
replace(target: { path: string; }) => void
resolvePath?((to: string | { path?: string; }, locale: string) => string | { path?: string; }) | undefined
Locale — 11 members, identical to [`Locale`](/api/packages/types). Translations — 1 members, identical to [`Translations`](/api/packages/types). UseI18nOptions — 2 members, identical to [`UseI18nOptions`](/api/packages/preact).
VirtualI18nConfig — 10 members
MemberType
base?string | undefined
defaultLocalestring
disablePageLocalesboolean
fallbackLocalestring
localeCodesstring[]
localeKeyToCodeRecord<string, string>
localesLocale[]
missingWarnboolean
syncWithVitePressboolean
translationDirstring
VitePressSiteDataLike — 1 members
MemberType
locales?Record<string, { lang?: string; link?: string; label?: string; }> | undefined
VitePressUserConfigLike — 7 members
MemberType
[string]unknown
base?string | undefined
locales?Record<string, unknown> | undefined
themeConfig?Record<string, unknown> | null | undefined
transformHead?((...args: any[]) => any) | undefined
transformPageData?((...args: any[]) => any) | undefined
vite?{ [key: string]: unknown; plugins?: Plugin[] | Plugin[][]; ssr?: { noExternal?: string | true | Array<string | RegExp>; [key: string]: unknown; }; } | undefined
VueI18nOptions — 6 members, identical to [`PreactI18nOptions`](/api/packages/preact).
WithI18nOptions — 20 members
MemberType
base?string | undefined
canonicalQueryWhitelist?string[] | undefined
defaultLocale?string | undefined
disablePageLocales?boolean | undefined
fallbackLocale?string | undefined
hreflangBaseLanguage?boolean | undefined
i18nRouting?boolean | undefined
localestring
localeKeyToCode?Record<string, string> | undefined
locales?Locale[] | undefined
messages?Record<string, Translations> | undefined
meta?boolean | undefined
metaBaseUrl?string | undefined
missingHandler?((locale: string, key: string, routeName: string) => void) | undefined
missingWarn?boolean | undefined
plural?PluralFunc | undefined
routeMessages?Record<string, Record<string, Translations>> | undefined
syncWithVitePress?boolean | undefined
translationDir?string | undefined
warnOnLocaleMismatch?boolean | undefined
## `@i18n-micro/vitepress/config`
ts
import { /* … */ } from '@i18n-micro/vitepress/config'
ExportKindSignature
buildVitePressLocaleHeadfunction(options: BuildVitePressLocaleHeadOptions) => VitePressLocaleHeadObject
BuildVitePressLocaleHeadOptionsinterface12 members
buildVitePressLocalesfunction(locales: Locale[], defaultLocale: string, options?: BuildVitePressLocalesOptions) => Record<string, VitePressLocaleEntry>
BuildVitePressLocalesOptionsinterface1 members
relativePathToRoutePathfunction(relativePath: string) => string
VirtualI18nConfiginterface10 members
VitePressHeadTupletype[string, Record<string, string>]
VitePressLocaleEntryinterface3 members
VitePressLocaleHeadObjectinterface2 members
VitePressUserConfigLikeinterface7 members
warnLocaleMismatchfunction(config: VitePressUserConfigLike, options: WithI18nOptions) => void
withI18nfunction<T extends VitePressUserConfigLike>(config: T, options: WithI18nOptions) => T
WithI18nOptionsinterface20 members
BuildVitePressLocaleHeadOptions — 12 members
MemberType
addDirAttribute?boolean | undefined
addSeoAttributes?boolean | undefined
base?string | undefined
canonicalQueryWhitelist?string[] | undefined
defaultLocalestring
hreflangBaseLanguage?boolean | undefined
identifierAttribute?string | undefined
localeKeyToCode?Record<string, string> | undefined
localesLocale[]
metaBaseUrl?string | undefined
missingWarn?boolean | undefined
pathstring
BuildVitePressLocalesOptions — 1 members
MemberType
localeKeyToCode?Record<string, string> | undefined
VirtualI18nConfig — 10 members, identical to `VirtualI18nConfig` above.
VitePressLocaleEntry — 3 members
MemberType
labelstring
langstring
link?string | undefined
VitePressLocaleHeadObject — 2 members
MemberType
headVitePressHeadTuple[]
htmlAttrs{ lang?: string; dir?: "ltr" | "rtl" | "auto"; }
VitePressUserConfigLike — 7 members, identical to `VitePressUserConfigLike` above. WithI18nOptions — 20 members, identical to `WithI18nOptions` above. ## `@i18n-micro/vitepress/node`
ts
import { /* … */ } from '@i18n-micro/vitepress/node'
ExportKindSignature
buildVitePressLocalesfunction(locales: Locale[], defaultLocale: string, options?: BuildVitePressLocalesOptions) => Record<string, VitePressLocaleEntry>
BuildVitePressLocalesOptionsinterface1 members
createI18nfunction(options: CreateI18nOptions) => NodeI18n
CreateI18nOptionsinterface11 members
I18nOptionsinterface7 members
LoadedTranslationsinterface2 members
loadRootTranslationsfunction(dir: string, disablePageLocales?: boolean) => Promise<Record<string, Translations>>
loadTranslationsfunction(dir: string, disablePageLocales?: boolean) => Promise<LoadedTranslations>
NodeI18ntypeI18n & PathMethods
VitePressLocaleEntryinterface3 members

BuildVitePressLocalesOptions — 1 members, identical to BuildVitePressLocalesOptions above.

CreateI18nOptions — 11 members
MemberType
base?string | undefined
defaultLocale?string | undefined
disablePageLocales?boolean | undefined
fallbackLocale?string | undefined
localestring
localeKeyToCode?Record<string, string> | undefined
locales?Locale[] | string[] | undefined
missingHandler?((locale: string, key: string, routeName: string) => void) | undefined
missingWarn?boolean | undefined
plural?PluralFunc | undefined
translationDir?string | undefined
I18nOptions — 7 members, identical to [`I18nOptions`](/api/packages/node). LoadedTranslations — 2 members, identical to [`LoadedTranslations`](/api/packages/astro). VitePressLocaleEntry — 3 members, identical to `VitePressLocaleEntry` above. ## `@i18n-micro/vitepress/theme`
ts
import { /* … */ } from '@i18n-micro/vitepress/theme'
ExportKindSignature
defineI18nThemefunction<T extends Theme>(base: T, options?: DefineI18nThemeOptions) => T
DefineI18nThemeOptionsinterface7 members
DefineI18nThemeOptions — 7 members
MemberType
config?VirtualI18nConfig | undefined
enhanceApp?((ctx: import("vitepress/types/index").EnhanceAppContext) => import("vitepress/types/shared").Awaitable<void>) | undefined
localeKeyToCode?Record<string, string> | undefined
messages?Record<string, Translations> | undefined
missingHandler?((locale: string, key: string, routeName: string) => void) | undefined
plural?PluralFunc | undefined
routeMessages?Record<string, Record<string, Translations>> | undefined

Back to all packages · Integration guides

Released under the MIT License.