import { Locale } from '@i18n-micro/types'; import { PluralFunc } from '@i18n-micro/types'; import { Theme } from 'vitepress'; import { Translations } from '@i18n-micro/types'; import { VueI18nOptions } from '@i18n-micro/vue'; declare interface CreateI18nOptions { locale: string; fallbackLocale?: string; locales?: Locale[]; defaultLocale?: string; messages?: Record; /** * Page-scoped dictionaries keyed by route name (`guide-demo`), then locale. * Loaded from `locales/pages/**` when using `withI18n`. */ routeMessages?: Record>; plural?: PluralFunc; missingWarn?: boolean; numberFormats?: VueI18nOptions['numberFormats']; datetimeFormats?: VueI18nOptions['datetimeFormats']; timeZone?: string; missingHandler?: (locale: string, key: string, routeName: string) => void; /** * Sync i18n locale from the VitePress URL path on every navigation. * @default true */ syncWithVitePress?: boolean; /** * Map VitePress locale keys to i18n codes (`root` → default locale code). */ localeKeyToCode?: Record; /** * VitePress `site.base`. Needed so SSG paths (`withBase`) and lang switcher * do not treat the base segment as content / double-prefix links. */ base?: string; } /** * Zero-boilerplate theme wiring. Requires `withI18n(...)` in `.vitepress/config` * so virtual config + messages modules exist. * * Uses **static** `virtual:i18n-micro/*` imports so VitePress SSG can rewrite them. * Import this helper from `@i18n-micro/vitepress/theme` (not the root entry) so Node * config evaluation never loads virtual modules. * * @example * ```ts * import DefaultTheme from 'vitepress/theme' * import { defineI18nTheme } from '@i18n-micro/vitepress/theme' * * export default defineI18nTheme(DefaultTheme) * ``` */ export declare function defineI18nTheme(base: T, options?: DefineI18nThemeOptions): T; export declare interface DefineI18nThemeOptions { /** * Extra `enhanceApp` run after i18n is installed. */ enhanceApp?: NonNullable; /** * Overrides for this theme: `plural` and `missingHandler` cannot be serialized into * `virtual:i18n-micro/config`; the formats and `timeZone` default to what `withI18n` got. */ plural?: PluralFunc; missingHandler?: (locale: string, key: string, routeName: string) => void; numberFormats?: CreateI18nOptions['numberFormats']; datetimeFormats?: CreateI18nOptions['datetimeFormats']; timeZone?: string; localeKeyToCode?: Record; /** * Optional overrides (tests / advanced). Defaults come from `virtual:i18n-micro/*` * registered by `withI18n`. */ config?: VirtualI18nConfig; messages?: Record; routeMessages?: Record>; } declare interface VirtualI18nConfig { defaultLocale: string; fallbackLocale: string; locales: Locale[]; localeCodes: string[]; missingWarn: boolean; syncWithVitePress: boolean; translationDir: string; disablePageLocales: boolean; localeKeyToCode: Record; /** VitePress `site.base` (normalized, trailing slash preserved from config). */ base?: string; numberFormats?: CreateI18nOptions['numberFormats']; datetimeFormats?: CreateI18nOptions['datetimeFormats']; timeZone?: string; } export { }