@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
50 lines • 2.36 kB
TypeScript
import { OptionsService } from '../common';
import { CachedLocaleDictionaryService } from './cached-locale-dictionary.service';
import { PluginsResolveService } from '../plugins/plugins-resolve.service';
import { Observable } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
import * as i0 from "@angular/core";
/**
* A service to load translations from different sources.
* It combines translations from the app, user-defined translations, and plugins.
* It also caches translations to avoid unnecessary requests.
*
* Is used instead of the default TranslateLoader functionality that ngx-translate provides as otherwise only the first translations from TranslateLoader observable would have been picked up.
* This would have been problematic, as we can only load the plugin translations after the login and we need to have at least the basic translations already on the login screen.
*/
export declare class TranslationLoaderService {
private optionsService;
private cachedLocaleDictionaryService;
private pluginResolverService;
private translateService;
private path;
private languages;
private cache;
private reloadTrigger$;
constructor(optionsService: OptionsService, cachedLocaleDictionaryService: CachedLocaleDictionaryService, pluginResolverService: PluginsResolveService, translateService: TranslateService, path?: string, languages?: {
[key: string]: {
url?: string;
};
} | null);
getTranslation(lang: string): Observable<{
[key: string]: string;
}>;
triggerReload(): void;
clearCache(): void;
protected getTranslationsForPugins(lang: string): Observable<{}>;
protected getTranslationsForPlugin(lang: string, pluginId: string): Observable<{
[key: string]: string;
}>;
protected getTranslationsFromApp(lang: string): Observable<{
[key: string]: string;
}>;
protected getUserDefinedTranslations(lang: string): Observable<{
[key: string]: string;
}>;
protected getTranslationFromPath(path: string, lang: string): Observable<{
[key: string]: string;
}>;
static ɵfac: i0.ɵɵFactoryDeclaration<TranslationLoaderService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TranslationLoaderService>;
}
//# sourceMappingURL=translation-loader.service.d.ts.map