UNPKG

@o3r/localization

Version:

This module provides a runtime dynamic language/translation support and debug tools.

53 lines 2.17 kB
import { ApplicationRef } from '@angular/core'; import { TranslateCompiler } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; import { LocalizationService } from '../tools'; import * as i0 from "@angular/core"; export declare class OtterLocalizationDevtools { private readonly localizationService; private readonly translateCompiler; private readonly appRef; constructor(localizationService: LocalizationService, translateCompiler: TranslateCompiler, appRef: ApplicationRef); /** * Is the translation deactivation enabled */ isTranslationDeactivationEnabled(): boolean; /** * Show localization keys * @param value value enforced by the DevTools extension */ showLocalizationKeys(value?: boolean): void; /** * Returns the current language */ getCurrentLanguage(): string; /** * Setup a listener on language change * @param fn called when the language is changed in the app */ onLanguageChange(fn: (language: string) => any): Subscription; /** * Switch the current language to the specified value * @param language new language to switch to */ switchLanguage(language: string | undefined): Promise<void>; /** * Updates the specified localization key/values for the current language. * * Recommendation: To be used with a small number of keys to update to avoid performance issues. * @param keyValues key/values to update * @param language if not provided, the current language value */ updateLocalizationKeys(keyValues: { [key: string]: string; }, language?: string): void | Promise<void>; /** * Reload a language from the language file * @see https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.service.ts#L490 * @param language language to reload */ reloadLocalizationKeys(language?: string): Promise<void>; static ɵfac: i0.ɵɵFactoryDeclaration<OtterLocalizationDevtools, never>; static ɵprov: i0.ɵɵInjectableDeclaration<OtterLocalizationDevtools>; } //# sourceMappingURL=localization-devtools.service.d.ts.map