import type{LyraLocaleStrings}from'../internal/localization-types.js';export{subscribeLyraLocale}from'../internal/localization-runtime.js'; /** * Scoped variant of the full-catalog `resolveLyraString()` (`@aceshooting/lyra-ui/localization.js`): * resolves `key` through the same override -> fallback -> registered-locale-catalog chain, but * against a caller-supplied `defaults` record instead of the complete built-in English catalog. * * Exists on this tree-shakable entry, not the full-catalog one, so a consumer resolving a handful * of messages for its own component never pulls in the compatibility catalog to do it: pass a small * `defaults` object of just the keys used, built from imported per-key constants (mirroring how a * generated Lyra component's own `defaultStrings` slice is built) or authored by hand. * * ```ts * import { resolveLyraScopedString } from '@aceshooting/lyra-ui/utilities/localization.js'; * * const label = resolveLyraScopedString(host, 'save', { save: 'Save' }); * ``` */ export declare function resolveLyraScopedString(host:Element,key:string,defaults:Readonly,overrides?:LyraLocaleStrings,fallback?:string,values?:Record):string; /** Options for {@linkcode bridgeLyraLocale}. */ export interface LyraLocaleBridgeOptions{ /** Element whose `lang`/`dir` mirror the active locale. Defaults to `document.documentElement`. * Pass an application root when the bridge should scope to a subtree instead of the page. */ target?:Element; /** Also mirror the locale's writing direction onto `dir`, resolved through * `getLyraLocaleDirection()`. Default `true`; set `false` when the application owns `dir` * itself (a bidi editor, a preview pane rendering the opposite direction on purpose). */ direction?:boolean;} /** Idempotent disposer returned by {@linkcode bridgeLyraLocale}. */ export type LyraLocaleBridgeCleanup=()=>void; /** * Mirrors the active Lyra locale onto an element's `lang` (and, by default, `dir`), keeping them in * sync for as long as the returned disposer has not been called. `lang` receives the runtime's * canonical public spelling (`PT_BR` supplied to `setLyraLocale()` is mirrored as `pt-BR`). * * `setLyraLocale()` only tells *this library* which locale is in force. Everything else on the page * reads the platform `lang`/`dir` cascade instead: `:lang()` selectors, hyphenation and quote * marks, spelling dictionaries, a screen reader's pronunciation of untranslated prose, and any * third-party widget. An application that switches locale at runtime therefore has to write those * attributes itself, and hand-rolling that is where the two drift apart. This is that glue, in one * supported place. * * Strictly opt-in: nothing here runs at import time, and the library never calls it for you -- * components read the inherited cascade and no component forces a direction of its own. * * With no active locale set (the default state, where components inherit from the document), the * bridge leaves the target's authored `lang`/`dir` exactly as it found them rather than blanking * them, and it restores them again if the active locale is later cleared. Multiple bridges for the * same target share one subscription and one authored-state snapshot. Their cleanup handles are * independent and order-insensitive; the authored state is restored only after the final handle * releases. Direction is mirrored while at least one active handle requests it. * * ```ts * import { bridgeLyraLocale } from '@aceshooting/lyra-ui/utilities/localization.js'; * import { setLyraLocale } from '@aceshooting/lyra-ui/localization.js'; * * const stop = bridgeLyraLocale(); // mirrors onto * setLyraLocale('ar'); // * stop(); // restores whatever carried before * ``` * * @throws TypeError when no target element is given and no ambient `document` exists (SSR) -- the * bridge is a DOM operation and silently doing nothing there would hide the mistake. */ export declare function bridgeLyraLocale(options?:LyraLocaleBridgeOptions):LyraLocaleBridgeCleanup;