UNPKG

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.

30 lines (29 loc) 1.17 kB
type CookieRef = { value: string | null; }; /** Callback to get locale from route (RouteService.getCurrentLocale) */ export type GetLocaleFromRoute = (route?: unknown) => string; export interface ResolveInitialLocaleOptions { route: unknown; serverLocale?: string | null; getLocaleFromRoute: GetLocaleFromRoute; } /** * Centralized entry point for i18n locale management. * Combines useState('i18n-locale'), locale cookie, and sync utilities. */ export declare function useI18nLocale(): { locale: import("vue").Ref<string | null, string | null>; localeCookie: CookieRef; hashCookie: CookieRef; getPreferredLocale: () => string | null; getLocale: () => string | null; getLocaleWithServerFallback: (serverLocale?: string | null) => string | null; getEffectiveLocale: (route: unknown, getLocaleFromRoute: GetLocaleFromRoute) => string; resolveInitialLocale: (options: ResolveInitialLocaleOptions) => string; setLocale: (locale: string | null) => void; syncLocale: (locale: string | null) => void; isValidLocale: (locale: string | null | undefined) => locale is string; validLocales: string[]; }; export {};