import { Provider, Signal } from '@tempots/dom'; /** * Creates an i18n provider that manages reactive translations for a given message type. * * The factory creates a `Provider` that automatically hooks into the `Locale` provider * to detect locale changes and dynamically load the corresponding translation messages. * It uses `makeMessages` internally for reactive translation management with fallback support. * * @typeParam M - The shape of the messages object (must extend `object`) * * @param config - Configuration object for the i18n provider * @param config.defaultLocale - The default locale code to use as fallback (e.g., `'en'`) * @param config.defaultMessages - The default messages object used before any locale is loaded * @param config.localeLoader - Async function that loads messages for a given locale string * @param config.providerName - Optional name for the provider mark, used for debugging * @default config.providerName `'I18nProvider'` * * @returns A `Provider>` that provides a reactive signal of the current messages * * @example * ```typescript * import { makeI18nProvider } from '@tempots/beatui' * * type MyMessages = { greeting: string; farewell: string } * * const MyI18n = makeI18nProvider({ * defaultLocale: 'en', * defaultMessages: { greeting: 'Hello', farewell: 'Goodbye' }, * localeLoader: async (locale) => { * const mod = await import(`./locales/${locale}.ts`) * return mod.default * }, * providerName: 'MyI18n', * }) * * // Use in a component * Use(MyI18n, t => html.p(t.$.greeting)) * ``` */ export declare function makeI18nProvider({ defaultLocale, defaultMessages, localeLoader, providerName, }: { /** The default locale code to use as fallback (e.g., `'en'`) */ defaultLocale: string; /** The default messages object used before any locale is loaded */ defaultMessages: M; /** Async function that loads messages for a given locale string */ localeLoader: (locale: string) => Promise; /** Optional name for the provider mark, used for debugging. @default 'I18nProvider' */ providerName?: string; }): Provider>;