/** * `@nifrajs/web-react/i18n` - React bindings for `@nifrajs/i18n`. `` builds a * `Formatter` (memoized) and provides it; `useT()` reads it. Both `locale` + `messages` are * serializable, so a loader returns them, the page renders with the negotiated catalog on the server, * and the client rebuilds the same formatter from the same props (no mismatch). In an app that * registers its locale routing (`i18n` in `backend/framework.ts`), `locale` defaults to the page's and * `useLocale()` names it. No JSX (the package builds with plain `tsc`). */ import { type Formatter, type FormatterOptions, type MessageKey, type RegisteredMessages, type Translation } from "@nifrajs/i18n"; import { type ReactNode } from "react"; export interface I18nProviderProps extends FormatterOptions { /** The locale to format in. Default: the page's locale tag, in an app that registers its locale * routing. */ readonly locale?: string; /** The catalog for `locale`, checked against the registered catalog type when one is declared. */ readonly messages: Translation; readonly children?: ReactNode; } /** Provide a {@link Formatter} (built from `locale` + `messages`, with the optional `fallback`, * `onMissing`, `timeZone` and `numberingSystem` of `createFormatter`) to the subtree. Memoized * on those props, so switching locale rebuilds it and re-renders consumers; formatters are cached by * catalog identity, so an inline `fallback={[en]}` still yields the same instance. */ export declare function I18nProvider(props: I18nProviderProps): ReactNode; /** Read the current {@link Formatter} (`{ locale, t, get, n, d }`). Throws if no `` is above. */ export declare function useT(): Formatter; /** * The page's locale key (`ur`, the URL segment), in an app that registers its locale routing (`i18n` * in `backend/framework.ts`): from the request on the server, from the URL after each navigation. * Without one, the nearest ``'s locale; with neither, it throws. */ export declare function useLocale(): string; /** Tag handlers for {@link rich}, by tag name: each receives its tag's content as one node. */ export type RichTags = Readonly ReactNode>>; /** * The message at `key` with its tags rendered by `tags`, as React nodes - no HTML, no * `dangerouslySetInnerHTML`. `"Read the terms"` with * `{ link: (content) => {content} }` renders the link around "terms"; a tag with * no handler renders its content as text, `
` is a `
`, and interpolated values are always * text. See `@nifrajs/i18n/rich`. */ export declare function rich(formatter: Formatter, key: MessageKey, tags?: RichTags, vars?: Readonly>): ReactNode; //# sourceMappingURL=i18n.d.ts.map