import type{LyraLocaleDirection,LyraLocaleMeta,LyraLocaleStrings}from'./localization-types.js'; /** Every locale with registered strings, plus 'en' (always available via DEFAULT_STRINGS even * with no explicit registerLyraLocale('en', ...) call), in canonical public BCP-47 spelling, * sorted and deduped by case-insensitive lookup identity. */ export declare function getRegisteredLyraLocales():readonly string[]; /** * A frozen snapshot of exactly the keys `locale`'s own registered catalog carries — no BCP-47 * fallback-chain widening and no merge with the built-in English defaults. This answers "what has * this locale actually been given", distinct from {@link getRegisteredLyraLocales}, which reports * registry *membership* (which tags exist) rather than catalog *content* (what keys a tag's own * catalog holds). Lets a consumer measure a locale's own translation coverage — for example diffing * the result's length against `Object.keys(LYRA_DEFAULT_STRINGS).length` — without a silent * English-fallback merge making a partial catalog look complete. * * An unregistered locale, including `'en'` when it was never itself passed to * {@link registerLyraLocale}, returns an empty snapshot: `'en'` is implicitly available through the * caller-supplied English defaults rather than through an entry in the registry this reads. */ export declare function getRegisteredLyraLocaleKeys(locale:string):readonly string[]; /** Subscribe to locale *registry membership* changes (a new locale registered) — distinct from * subscribeLyraLocale(), which fires for active-locale selection and relevant active-catalog * changes. Extending an already registered catalog does not change membership and does not fire. * Only a consumer that enumerates the registry (lr-locale-picker) needs this; every other * component's rendered strings are unaffected by a registration for a locale it isn't using, so * registerLyraLocale() must not force a global requestUpdate() on every mounted component just * to reach the one picker that cares. * * All listeners in the starting snapshot receive an eligible change. If one or more callbacks * throw, delivery finishes and the committing register call then throws one `AggregateError`. */ export declare function subscribeLyraLocaleRegistry(listener:()=>void):()=>void; /** Remembers that a connected Lyra host's owner was once backed by a browsing context. */ export declare function recordLyraOwnerDocumentConnection(host:Element):void;export declare function registerLyraLocale(locale:string,strings:LyraLocaleStrings,meta?:LyraLocaleMeta):void; /** * The writing direction to use for `locale`, as an application would put in `dir`. * * Resolution order, stopping at the first answer: * * 1. A `dir` declared by {@link registerLyraLocale}'s `meta` argument, walked through the same * candidate chain messages use — so `ar-EG` inherits the `ar` catalog's declaration. * 2. `Intl.Locale`'s text-info surface, which is feature-detected rather than assumed: it is * spelled as a `textInfo` accessor in some engines, a `getTextInfo()` method in others, and * is absent in older ones. A structurally invalid tag throws here and is caught. * 3. `'ltr'`, the platform default. * * This never *applies* a direction. Components read the inherited `dir` cascade and no component * forces one from `lang`; this is the lookup an application needs to set `dir` itself. */ export declare function getLyraLocaleDirection(locale:string):LyraLocaleDirection; /** * Set the page-level locale used by Lyra components without an explicit locale. * * This beats ``. It did not until 9.0.0: `inheritedLocale()` consulted the document * element before the active locale (and reached it a second time through the ancestor walk), so on * any well-formed page -- one that declares ``, i.e. essentially all of them -- * `setLyraLocale('fr')` resolved to `'en'` and looked like a no-op. A per-subtree `locale`/`lang` * attribute on the component or any ancestor still wins over both, because that is a deliberate * scoped override rather than a page default. * * The stored/returned value follows the same canonical public tag path as registration. Equivalent * spellings are a no-op. Listener failures cannot interrupt delivery: the new locale commits, all * eligible starting-snapshot listeners run, then one `AggregateError` is thrown if any failed. */ export declare function setLyraLocale(locale:string):void; /** Return the current page-level locale. */ export declare function getLyraLocale():string; /** * Resolves a `locale` argument for a standalone, host-less locale-aware utility function -- * `formatNumber()`/`formatDate()`/`formatRelativeTime()`/`formatBytes()` (`utilities/format.ts`) * and `binValues()` (`components/charts/chart/histogram-bin.ts`) are the current callers. These * have no component host to inherit a locale from the way {@link inheritedLocale} does, so an * omitted, empty/whitespace, or `'auto'` value means {@link setLyraLocale}'s active locale instead * -- the one piece of that inheritance chain a plain function call can still observe. A * non-empty, non-`'auto'` value is returned unchanged and stays authoritative over the active * locale, exactly like an explicit argument always has. * * This deliberately stops at the active locale and does NOT fall through to `` (let * alone `navigator.language`, which no part of this library's resolution chain reads) the way * {@link inheritedLocale} does for a component host with no closer signal: a document's `lang` * attribute is metadata a *host element* inherits by walking the DOM, and a bare function call * has no host to walk from. Silently reading the document here would also break the one * compatibility guarantee this function exists to preserve -- see the next paragraph. * * `activeLocale` is `''` before any `setLyraLocale()` call, and `''` is returned as-is (never * coerced to `'en'` here): every `Intl` cache getter's own `resolveIntlLocale()` step * (`internal/intl-cache.ts`) already normalizes an empty/undefined locale to `'en'`, so an app * that never calls `setLyraLocale()` gets exactly the deterministic English output it always has * -- this function changes nothing for that app. */ export declare function resolveActiveOrExplicitLocale(locale:string|undefined):string|undefined; /** * Subscribe to active-locale selection changes and registrations that can alter the active * locale's messages or direction. Unrelated catalog registrations are registry-only and do not * fire this channel. The returned function is safe to call repeatedly. * * Listener failures are isolated until the eligible starting snapshot has run; the mutator then * throws one `AggregateError` containing every callback error. */ export declare function subscribeLyraLocale(listener:()=>void):()=>void; /** * Opts a host into memoized locale/direction resolution. The host must call * `invalidateLyraLocaleCache()` whenever a new update cycle is scheduled and * on (re)connection, so a memo never outlives the render pass that produced * it. An ancestor `lang`/`dir` change mid-cycle is only reflected in rendered * output on the next update anyway, so per-cycle reuse changes nothing * observable. */ export declare function enableLyraLocaleCache(host:Element):void; /** Drops a host's memoized locale/direction so the next read re-resolves. */ export declare function invalidateLyraLocaleCache(host:Element):void; /** Resolve the locale inherited by a component host. */ export declare function resolveLyraLocale(host:Element):string; /** Resolve the direction inherited by a component host. */ export declare function resolveLyraDirection(host:Element):'ltr'|'rtl'; /** * Reads a host's already-memoized locale/direction without resolving anything -- in particular, * without `resolveLyraDirection()`'s `getComputedStyle()` call. `undefined` when the host was * never opted into caching, or opted in but never actually read `effectiveLocale`/ * `effectiveDirection` (so its own render never populated the memo). Lets a caller establish a * "what's currently rendered" baseline for free, piggybacking on whatever the host's own last * render already computed, instead of forcing a fresh (potentially expensive or, for * `getComputedStyle()` specifically, disruptive -- see `observeInheritedContext()`) resolution * purely to seed a comparison. */ export declare function peekLyraLocale(host:Element):string|undefined; /** @see peekLyraLocale */ export declare function peekLyraDirection(host:Element):'ltr'|'rtl'|undefined; /** * Resolve a message for a component. An explicit per-component override wins, * followed by a non-empty component property fallback, registered locale * messages, and finally the built-in English message. * * A resolved message may be a plain string (unchanged behaviour) or a * {@link LyraPluralMessage}; the latter is reduced to one string by * `Intl.PluralRules` before interpolation, so the return type stays `string` * and every caller's contract is untouched. * * In dev mode (see {@link devWarnOnce}), a non-English resolved locale that reaches this point with * no registered catalog message warns once per (locale, key) via {@link warnLocaleFallback} -- * production and non-dev-mode builds stay silent. */ export declare function resolveLyraString(host:Element,key:string,overrides?:LyraLocaleStrings,fallback?:string,values?:Record,defaults?:Readonly):string; /** * Returns the text around one rich localized interpolation. `interpolate` must resolve the * message through the normal localization values argument with its supplied marker as the rich * value. The marker is selected outside the translated template so repeated and omitted * placeholders remain well-defined without parsing a localization token by hand. Sentinel * selection is linear in the template with fixed auxiliary bounds; the marker is at most two * UTF-16 code units even for an adversarial template containing every one-unit candidate. */ export declare function resolveLocalizedParts(template:string,interpolate:(marker:string)=>string):string[];