///
import { Translations } from './translations.js';
import { DistributiveKeyOf } from './tsHelper.js';
type LocalizationSubscriber = (translations: Partial, string>>) => void;
interface LocalizationSubscription {
cancel(): void;
}
declare class Localization {
private static instance?;
private translations;
private subscribers;
static getInstance(): Localization;
/**
* @description Given a key, returns a single translation. You can pass a generic to define the scope of the
* translations you have.
*
* @example
* // When using the barcode module
* Localization.getInstance().get("core.camera.recovery")
*
* @param key One of the keys of the passed Generic interface
* @returns the corresponding translation, or an empty string if the key was not found.
*/
get(key: keyof K): string;
/**
* @returns An object containing all the translations
*/
getAll(): Record, string>;
/**
* @description Update the translations with the given object.
* @param {object} translations An object containing all or a subset of all translations
*/
update(translations: Partial, string>>): void;
/**
* @description Update all translations that are passed in argument but only if not already present. Useful to avoid
* overwriting translation that the customer may have set early in the code.
* @param {object} translations An object containing all or a subset of all translations
*/
updateIfMissing(translations: Partial, string>>): void;
private subscribe;
}
export { Localization, type LocalizationSubscriber, type LocalizationSubscription };