import { Observable } from 'rxjs'; import { Language } from './language'; /** * Options to initialize the localization manager */ export interface LocalizationManagerOptions { /** * The URL path (relative or absolute) * to the resources folder containing the json files with the localized assets. * defaults to '/assets/strings' if not specified. * Ex: '/assets/strings' */ resourcesPath?: string; /** * The Azure locale to start localization manager with */ azureLocale?: string; } export interface LocaleSet { /** * The locale ID covering all reginal locale. */ id: string; /** * The neutral ID used for loading string resources. */ neutral: string; } /** * Class to retrieve localized resources based on the user locale * This class lets you load resources from a json file in an * arbitrary location and determines what locale resources to return * on the user preference */ export declare class LocalizationManager { private options?; private static defaultResourcesStringsFolder; private static resourcesStringsFile; private static resourcesStringsFileFormat; private static languageManager; static localStorageLocaleKey: string; static localStorageLocaleSetKey: string; static neutralCultures: Language[]; static regionalCultures: Language[]; private readonly defaultLocaleId; private resourcesStringFormat; private resourcesStringDefaultFile; private http; private localeIdInternal; private resourcesPath; /** * Initializes a new instance of the LocalizationManager class that reads the localized assets from * the given locations. * @param options? The options to initialize the localization manager. */ constructor(options?: LocalizationManagerOptions); /** * Gets current locale. * @return string the locale string. */ get localeId(): LocaleSet; /** * Gets the navigator language */ getNavigatorLanguage(): string; /** * Creates a LocaleSet from a string */ createLocaleSet(id: string, neutral?: string): LocaleSet; /** * Sets the current locale in persistent storage * @param localeId the string representing the locale selected by the user. Ex: 'es' or 'en' */ saveLocale(localeSet: LocaleSet): void; /** * Updates the lang attribute of the document to reflect the current locale. */ updateDocumentLanguage(): any; /** * Ensures Resources are Initialized */ private initializeResources; /** * Gets the current locale. * Throughout code, locale code is using - format which is standard on both Microsoft Edge and Google Chrome. * ex) en-US, de-DE, ja-JP and so on. * @returns The current locale selected by the user */ getLocaleId(): LocaleSet; /** * Fetches the localized strings from the server based on the current culture. * @returns an observable with object the localized strings. */ fetchLocalizedStrings(): Observable; private configureFetchFiles; checkBothAvailable(localeSet: LocaleSet): boolean; private checkIdAvailable; private fetchDefaultStrings; private fetchLocaleStrings; private normalizeAzureLocaleId; }