UNPKG

@shelchin/svelte-i18n

Version:

The last Svelte i18n library you'll ever need. Type-safe, AI-powered, zero-config.

42 lines (41 loc) 1.49 kB
/** * Enhanced auto-discovery system based on index.json configuration * This is a supplementary mechanism - only works when index.json exists */ import type { I18nInstance } from '../core/types.js'; export interface AutoDiscoveryConfig { app?: string[]; packages?: { [packageName: string]: string[]; }; } export interface AutoDiscoveryOptions { translationsPath?: string; indexFile?: string; namespace?: string; onError?: (target: string, locale: string, error: Error) => void; onLoaded?: (target: string, locale: string) => void; } /** * Get the cached auto-discovery configuration * This is useful for other modules that need to check what languages are configured */ export declare function getCachedAutoDiscoveryConfig(): { autoDiscovery?: AutoDiscoveryConfig; } | null; /** * Load the auto-discovery configuration (with caching) */ export declare function loadAutoDiscoveryConfig(translationsPath?: string, indexFile?: string): Promise<{ autoDiscovery?: AutoDiscoveryConfig; } | null>; /** * Load translations based on auto-discovery configuration * @param i18n The i18n instance to load translations into * @param options Configuration options */ export declare function autoDiscoverTranslations(i18n: I18nInstance, options?: AutoDiscoveryOptions): Promise<void>; /** * Helper function to check if auto-discovery is available */ export declare function isAutoDiscoveryAvailable(translationsPath?: string): Promise<boolean>;