UNPKG

@shelchin/svelte-i18n

Version:

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

37 lines (36 loc) 1.3 kB
/** * Built-in translations loader * Loads translations that are bundled with the application */ import type { I18nInstance } from '../core/types.js'; export interface TranslationRegistry { [namespace: string]: { [locale: string]: Record<string, unknown>; }; } /** * Clear all registered translations (for testing) */ export declare function clearRegisteredTranslations(): void; /** * Register built-in translations * This should be called during app initialization */ export declare function registerBuiltInTranslations(translations: TranslationRegistry): void; /** * Load built-in translations into the store synchronously * Used during SSR to ensure translations are available immediately */ export declare function loadBuiltInTranslationsSync(store: I18nInstance): void; /** * Load built-in translations into the store */ export declare function loadBuiltInTranslations(store: I18nInstance, options?: { onLoaded?: (locale: string) => void; onError?: (locale: string, error: Error) => void; }): Promise<void>; /** * Auto-discover and register package translations * Packages can call this during their initialization */ export declare function registerPackageTranslations(packageName: string, translations: Record<string, Record<string, unknown>>): void;