/** * i18n context + reactive store (Sweep S13 #1418). * * The `Provider` builds an `I18nStore` from a server snapshot and puts it on a * Svelte context; `useI18n()` / `$t` / `` read it synchronously. Browser * safe — interpolation uses the client's own dependency-free `renderTemplate` * (see ./render.ts) so the heavy languages package is never bundled client-side. */ import { type LanguageVariables } from './render.js'; /** A per-locale dictionary of message templates, as built on the server. */ export interface I18nSnapshot { /** The active locale (normalized BCP-47-ish tag). */ locale: string; /** `key → template` for the active locale. Variables are applied client-side. */ messages: Record; } /** * Reactive holder for the active locale + message templates. Locale switching * (assigning `snapshot`) re-renders every `$t` / `` reading this store. */ export declare class I18nStore { #private; constructor(snapshot?: Partial); get locale(): string; /** Replace the active snapshot (e.g. on a locale switch). */ set snapshot(snapshot: I18nSnapshot); /** * Resolve and interpolate a message. Resolution order: server-snapshot * template → registered English default → the key itself (a loud, * never-blank fallback). Interpolation uses the same `renderTemplate` the * server uses, so `{var}` placeholders render identically. */ t: (key: string, vars?: LanguageVariables) => string; } /** Create a store from a snapshot (used by `Provider`). */ export declare function createI18nContext(snapshot?: Partial): I18nStore; /** Put an i18n store on context (used by `Provider`). */ export declare function setI18nContext(store: I18nStore): I18nStore; /** Read the i18n store, or `null` when there is no `Provider` above. */ export declare function tryGetI18nContext(): I18nStore | null; /** Read the i18n store, creating a default fallback if there is no Provider. */ export declare function getI18nContext(): I18nStore; //# sourceMappingURL=context.svelte.d.ts.map