@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
34 lines (33 loc) • 1.08 kB
TypeScript
import GirafeSingleton from '../../base/GirafeSingleton.js';
import IGirafeContext from '../context/icontext.js';
/**
* A dictionary that holds translation strings.
* For example:
* {
* 'layer': 'couche'
* }
*/
export type TranslationsDict = {
[lang: string]: string;
};
declare class I18nManager extends GirafeSingleton {
private readonly translations;
private readonly translationAliases;
private loadingLanguagePromise;
constructor(context: IGirafeContext);
initializeSingleton(): void;
private formatNumber;
ensureTranslationLoaded(): Promise<boolean>;
private loadTranslations;
getTranslation(key: string): string;
translate(dom: DocumentFragment | HTMLElement): Promise<void>;
private handleLanguageChange;
private getFnTranslated;
/**
* Define a translation alias.
* The alias will use the same translation as the key.
* But if the key already has another translation, the alias will be ignored
*/
addTranslationAlias(key: string, alias: string): void;
}
export default I18nManager;