@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
67 lines (64 loc) • 2.44 kB
TypeScript
import { ApplicationService, FetchClient, IApplication } from '@c8y/client';
import { AppStateService, ZipService } from '@c8y/ngx-components';
import * as i0 from '@angular/core';
interface TranslationLocale {
label: string;
locale: string;
}
declare class TranslationStoreService {
private appService;
private appState;
private zip;
private fetchClient;
protected readonly translationAppName = "User defined translations";
protected readonly translationAppContextPath = "user-defined-translations";
constructor(appService: ApplicationService, appState: AppStateService, zip: ZipService, fetchClient: FetchClient);
/**
* Retrieves a list of available translations for the given locales from all the hosted apps available on the tenant.
*/
getAvailableTranslations(locales: string[]): Promise<{
[key: string]: {
[locale: string]: string;
};
}>;
/**
* Retrieves the translations for the given locale from the translation app.
*/
getTranslationsForLocale<T extends string>(locale: T): Promise<{
[key: string]: string;
}>;
/**
* Retrieves the translations for the given locales from the translation app.
*/
loadTranslationsForLocales(locales: string[]): Promise<{
[key: string]: {
[key: string]: string;
};
}>;
/**
* Retrieves a combined list of translations for all the provided locales.
* The locales are combined into a single object per key and an array of these objects is returned.
*/
getCombinedListOfTranslationsForPerKey(locales: string[]): Promise<{
key: string;
[locale: string]: string;
}[]>;
/**
* Updates the files of the translation application with the provided translations.
*/
updateTranslations(translations: {
key: string;
[locale: string]: string;
}[]): Promise<void>;
/**
* @returns The translation app for the current tenant. If it does not exist, it will be created.
*/
getOrCreateTranslationApp(): Promise<IApplication>;
private getFileFromTranslationApp;
private getFileFromPath;
static ɵfac: i0.ɵɵFactoryDeclaration<TranslationStoreService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TranslationStoreService>;
}
export { TranslationStoreService };
export type { TranslationLocale };
//# sourceMappingURL=index.d.ts.map