import { DictionaryEntrySnapshot, DictionaryLookup, DictionaryObjectSnapshot, StoreListener, TranslateEventListener, TranslateLookup, TranslateSnapshot, Unsubscribe } from "./storeTypes.js"; import { Dictionary, Translation } from "gt-i18n/types"; import { Hash, Locale } from "gt-i18n/internal/types"; //#region src/i18n-store/I18nStore.d.ts type DictionaryStoreListener = (event: DictionaryLookup) => void; /** * I18nStore gives us the ability to perform client-side updates to translations. * Primarily useful for dev hot reload. * * This is the stateful primitive behind lookup subscriptions and runtime * translation requests. It intentionally does not know whether lookups are * being served from SPA singletons or SRA provider snapshots; that policy lives * in LookupAdapter, not in this store. */ declare class I18nStore { private translateListeners; private dictionaryEntryListeners; private dictionaryObjectListeners; private loggedRuntimeTranslationErrors; /** * I18nCache must be already initialized */ constructor(); updateTranslations: (translations: Record>) => void; updateDictionaries: (dictionaries: Record) => void; translate: (lookup: TranslateLookup) => Promise; translateDictionaryEntry: (lookup: DictionaryLookup) => void; translateDictionaryObject: (lookup: DictionaryLookup) => void; /** * Runtime translation runs fire-and-forget, so a rejected request (for * example a 401 from an invalid dev API key) is logged here instead of * escaping as an unhandled rejection that kills the dev server during SSR. * Identical failures log once. */ private logRuntimeTranslationError; subscribeToTranslate: (lookup: TranslateLookup, listener: StoreListener) => Unsubscribe; subscribeToTranslationEvents: (listener: TranslateEventListener) => Unsubscribe; subscribeToDictionaryEntryEvents: (listener: DictionaryStoreListener) => Unsubscribe; subscribeToDictionaryObjectEvents: (listener: DictionaryStoreListener) => Unsubscribe; getTranslateSnapshot: (lookup: TranslateLookup, translationsSnapshot?: Record>) => TranslateSnapshot; getDictionaryEntrySnapshot: (lookup: DictionaryLookup, dictionariesSnapshot?: Record) => DictionaryEntrySnapshot; getDictionaryObjectSnapshot: (lookup: DictionaryLookup, dictionariesSnapshot?: Record) => DictionaryObjectSnapshot; private emitTranslateEvent; private emitDictionaryEvent; } //#endregion export { I18nStore }; //# sourceMappingURL=I18nStore.d.ts.map