nuxt-i18n-micro
Version:
Nuxt I18n Micro is a lightweight, high-performance internationalization module for Nuxt, designed to handle multi-language support with minimal overhead, fast build times, and efficient runtime performance.
84 lines (83 loc) • 7.24 kB
TypeScript
import type { RouteLocationNormalizedLoaded, RouteLocationRaw, RouteLocationResolved, RouteLocationResolvedGeneric, RouteLocationNamedRaw } from 'vue-router';
import type { Locale, I18nRouteParams, Params, Translations, CleanTranslation } from 'nuxt-i18n-micro-types';
declare const _default: import("nuxt/app").Plugin<{
i18n: undefined;
__micro: boolean;
getLocale: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric) => string;
getLocaleName: () => string | null;
defaultLocale: () => string | undefined;
getLocales: () => Locale[];
getRouteName: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric, locale?: string) => string;
t: (key: string, params?: Params, defaultValue?: string | null, route?: RouteLocationNormalizedLoaded) => CleanTranslation;
ts: (key: string, params?: Params, defaultValue?: string, route?: RouteLocationNormalizedLoaded) => string;
_t: (route: RouteLocationNormalizedLoaded) => (key: string, params?: Params, defaultValue?: string | null) => CleanTranslation;
_ts: (route: RouteLocationNormalizedLoaded) => (key: string, params?: Params, defaultValue?: string) => string;
tc: (key: string, params: number | Params, defaultValue?: string) => string;
tn: (value: number, options?: Intl.NumberFormatOptions) => string;
td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string;
has: (key: string, route?: RouteLocationNormalizedLoaded) => boolean;
mergeTranslations: (newTranslations: Translations) => void;
mergeGlobalTranslations: (newTranslations: Translations) => void;
switchLocaleRoute: (toLocale: string) => string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
clearCache: () => void;
switchLocalePath: (toLocale: string) => string;
switchLocale: (toLocale: string) => string | false | void | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric | Promise<false | void | import("vue-router").NavigationFailure>;
switchRoute: (route: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, toLocale?: string) => string | false | void | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric | Promise<false | void | import("vue-router").NavigationFailure>;
localeRoute: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => RouteLocationResolved;
localePath: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => string;
setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
}> & import("nuxt/app").ObjectPlugin<{
i18n: undefined;
__micro: boolean;
getLocale: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric) => string;
getLocaleName: () => string | null;
defaultLocale: () => string | undefined;
getLocales: () => Locale[];
getRouteName: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric, locale?: string) => string;
t: (key: string, params?: Params, defaultValue?: string | null, route?: RouteLocationNormalizedLoaded) => CleanTranslation;
ts: (key: string, params?: Params, defaultValue?: string, route?: RouteLocationNormalizedLoaded) => string;
_t: (route: RouteLocationNormalizedLoaded) => (key: string, params?: Params, defaultValue?: string | null) => CleanTranslation;
_ts: (route: RouteLocationNormalizedLoaded) => (key: string, params?: Params, defaultValue?: string) => string;
tc: (key: string, params: number | Params, defaultValue?: string) => string;
tn: (value: number, options?: Intl.NumberFormatOptions) => string;
td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string;
has: (key: string, route?: RouteLocationNormalizedLoaded) => boolean;
mergeTranslations: (newTranslations: Translations) => void;
mergeGlobalTranslations: (newTranslations: Translations) => void;
switchLocaleRoute: (toLocale: string) => string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
clearCache: () => void;
switchLocalePath: (toLocale: string) => string;
switchLocale: (toLocale: string) => string | false | void | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric | Promise<false | void | import("vue-router").NavigationFailure>;
switchRoute: (route: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, toLocale?: string) => string | false | void | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric | Promise<false | void | import("vue-router").NavigationFailure>;
localeRoute: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => RouteLocationResolved;
localePath: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => string;
setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
}>;
export default _default;
export interface PluginsInjections {
$getLocale: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric) => string;
$getLocaleName: () => string | null;
$getLocales: () => Locale[];
$defaultLocale: () => string | undefined;
$getRouteName: (route?: RouteLocationNamedRaw | RouteLocationResolvedGeneric, locale?: string) => string;
$t: (key: string, params?: Params, defaultValue?: string | null) => CleanTranslation;
$_t: (route: RouteLocationNormalizedLoaded) => (key: string, params?: Params, defaultValue?: string | null) => CleanTranslation;
$ts: (key: string, params?: Params, defaultValue?: string) => string;
$_ts: (route: RouteLocationNormalizedLoaded) => (key: string, params?: Params, defaultValue?: string | null) => string;
$tc: (key: string, params: number | Params, defaultValue?: string) => string;
$tn: (value: number, options?: Intl.NumberFormatOptions) => string;
$td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
$tdr: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
$has: (key: string) => boolean;
$mergeTranslations: (newTranslations: Translations) => void;
$mergeGlobalTranslations: (newTranslations: Translations) => void;
$switchLocaleRoute: (locale: string) => RouteLocationRaw;
$switchLocalePath: (locale: string) => string;
$switchLocale: (locale: string) => void;
$switchRoute: (route: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
$localeRoute: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => RouteLocationResolved;
$localePath: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => string;
$setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
}