import type { AppLocale } from "../app/types.js"; import vi from "./messages/vi.json" with { type: "json" }; export type Messages = typeof vi; export declare const MESSAGE_CATALOG: Record>; export type MessageKey = string; /** * ADD AN APPLICATION'S OWN STRINGS TO THE LIBRARY'S CATALOG. * * The catalog used to be closed: `MESSAGE_CATALOG` was exported but there was no way to extend it, * so an application had to run a SECOND translation system beside this one — two lookups, two * fallback chains, and two places a missing key can hide. That is a real cost for a product whose * pages mix library chrome and application copy in the same sentence. * * MERGES, never replaces: a partial tree is layered onto what is already there, so registering * `{ myApp: { title: "…" } }` cannot delete `dataEntry.calendar.today`. Registering the same key * twice is last-write-wins, which is what a hot reload needs and what a second call with corrected * copy expects. * * A LIBRARY KEY CANNOT BE SILENTLY REPLACED. Overwriting `dataEntry.*` or any other namespace this * package ships would let one application change what a shared component says — invisibly, from a * distance, and only in the build where that call ran. Reach for the component's own labels prop * instead; every string this library renders has one. */ export declare function registerMessages(locale: AppLocale, messages: Record): void; export type TranslateParams = Record; /** Resolve a dot-path message with fallback locale chain, CLDR plurals, and locale number formatting. */ export declare function translate(locale: AppLocale, fallbackLocale: AppLocale, key: MessageKey, params?: TranslateParams): string; /** Non-React translate using module-synced locale (see `syncI18nLocale`). */ export declare function translateCurrent(key: MessageKey, params?: TranslateParams): string; export declare function syncI18nLocale(locale: AppLocale, fallbackLocale: AppLocale): void; export declare function getSyncedLocale(): AppLocale; export declare function getSyncedFallbackLocale(): AppLocale; /** Reset for tests. */ export declare function resetI18nLocale(): void;