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; /** * @internal `registerLocale`'s half of the catalog. For a locale the library does NOT ship * (`allowLibraryNamespaces`), the pack translates the library's own strings, so its `dataEntry.*` * and friends are exactly what it is for; for `vi` / `en` / `ja` the reserved-namespace rule of * `registerMessages` still applies. */ export declare function registerLocaleMessages(locale: AppLocale, messages: Record, allowLibraryNamespaces: boolean): 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 the CURRENT scope's locale (see `syncI18nLocale`, `runWithAppSettings`). */ export declare function translateCurrent(key: MessageKey, params?: TranslateParams): string; /** * Tell non-React callers in the CURRENT scope which locale to use. `AppProvider` calls it while * rendering; inside `runWithAppSettings` it writes that request's state only. */ export declare function syncI18nLocale(locale: AppLocale, fallbackLocale: AppLocale): void; /** Whether anything chose a locale for the current scope — the resting default was never CHOSEN. */ export declare function isI18nLocaleSynced(): boolean; /** * The current scope's locale; unset → `` if registered, else `en`. * @deprecated Inside React read `useTranslation().locale`; outside it, this reads the current * `runWithAppSettings` scope. */ export declare function getSyncedLocale(): AppLocale; /** @deprecated Inside React read `useTranslation().fallbackLocale`. */ export declare function getSyncedFallbackLocale(): AppLocale; /** Reset the current scope's locale — for tests. */ export declare function resetI18nLocale(): void;