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.

32 lines (31 loc) 1.55 kB
import type { RouteLocationNormalizedLoaded } from 'vue-router'; /** * Extracts the base route pattern from a matched route path * Converts Vue Router dynamic route patterns to file-based route patterns * * @param matchedPath - The matched route path from route.matched[0].path * @returns The base route pattern (e.g., "/test/[param]") * * @example * extractBaseRoutePattern('/:locale(es)/test/:param()') // Returns '/test/[param]' * extractBaseRoutePattern('/:locale(en)/static') // Returns '/static' * extractBaseRoutePattern('/:locale(fr)/about/:id') // Returns '/about/[id]' */ export declare function extractBaseRoutePattern(matchedPath: string): string; /** * Finds allowed locales for a route using various matching strategies * * @param route - The route object * @param routeLocales - The routeLocales configuration object * @returns Array of allowed locale codes or null if no restrictions */ export declare function findAllowedLocalesForRoute(route: RouteLocationNormalizedLoaded, routeLocales: Record<string, string[]> | undefined): string[] | null; /** * Checks if meta tags should be disabled for a route * * @param route - The route object * @param routeDisableMeta - The routeDisableMeta configuration object * @param currentLocale - The current locale code * @returns True if meta tags should be disabled, false otherwise */ export declare function isMetaDisabledForRoute(route: RouteLocationNormalizedLoaded, routeDisableMeta: Record<string, boolean | string[]> | undefined, currentLocale?: string): boolean;