@evan.network/ui-angular-core
Version:
The angular-core operates as an global and central library for the evan.network Angular 5 frontend development. Using this project you will be able to to the following things:
142 lines (141 loc) • 4.89 kB
TypeScript
import { // '@angular/core';
TranslateService, // @ngx-translate/core
OnDestroy } from 'angular-libs';
import { SingletonService } from '../singleton-service';
import { EvanUtilService } from '../utils';
/**************************************************************************************************/
/**
* I18N utility functions. Make it possible to share i18n through all
* applications
*
* @class Injectable EvanTranslationService
*/
export declare class EvanTranslationService implements OnDestroy {
translate: TranslateService;
private singleton;
private utils;
/**
* function that is called, when i18n was added globally
*/
private translateWatcher;
/**
* translated month short names for simple ion-date usage
*/
monthShortNames: Array<string>;
/**
* load dependencies and register translation updater watcher
*/
constructor(translate: TranslateService, singleton: SingletonService, utils: EvanUtilService);
/**
* remove translation watchers on service destroy
*
* @return {<type>} { description_of_the_return_value }
*/
ngOnDestroy(): void;
/**
* Set to the translation service the default language to en and the language
* to use.
*
* Usage:
* this.translateService.setLanguage('en')
*
* @param {string} language Language to use (en, fr, it, ...)
*/
setLanguage(language?: string): void;
/**
* Reload all translations for the current language.
*/
reloadTranslations(): void;
/**
* Set translations for multiple languages
*
* Usage:
* this.translateService.setMultipleLanguageTranslations({
* en : { 'hello' : 'Hello' },
* de : { 'hello' : 'Hallo' }
* });
*
* @param {any} translations Translations objects wrapped by
* language keys { en : { 'hello' :
* 'Hello' }, de : { 'hello' : 'Hallo' } }
*/
setMultipleLanguageTranslations(translations: any): void;
/**
* Adds translations to the shared translate service
*
* Usage:
* this.translateservice.setTranslation('en', {
* 'key1': 'translated 1',
* 'key2': 'translated 2'
* })
*
* @param {string} language Language to set translations for
* @param {any} translations Translations to add.
* @param {boolean} disableEvent dont trigger translation update event
*/
setTranslation(language: string, translations: any, disableEvent?: boolean): void;
/**
* Adds translations to the current language service
*
* Usage:
* this.translateservice.setTranslationToCurrentLanguage({
* 'key1': 'translated 1',
* 'key2': 'translated 2'
* })
*
* @param {any} translations Translations to add.
*/
setTranslationToCurrentLanguage(translations: any): void;
/**
* Returns an translated key instant.
*
* Usage:
* this.translateservice.instant('key1', { param1: '...' })
*
* @param {string|any} key Key to translate or an object that
* contains key and translateOptions params
* @param {any} options translation options
*/
instant(key: string | any, options?: any): string;
/**
* Use I18N object from DApp and add an translated property to the DApp, where
* translations for the current language are saved.
*
* Usage: have a look into the description service, getDescription function
*
* @param {any} dapp DApp definition from ENS.
* @return {any} The translated dapp description.
*/
getTranslatedDescription(dapp: any): any;
/**
* Adds a single translation to the current language.
*
* Usage:
* this.translateservice.addSingleTranslation('key1', 'translated 1')
*
* @param {string} key key to add
* @param {string} translation value for the key
*/
addSingleTranslation(key: string, translation: string): void;
/**
* Returns the current language.
*
* Usage:
* this.translateservice.getCurrentLang()
*
* @return {string} The current language key
*/
getCurrentLang(): string;
/**
* Adds a translation update watcher.
*
* Usage:
* const clearFunc = this.translateservice.watchTranslationUpdate(() => {
* console.log('translations added!')
* }))
*
* @param {Function} callback function that is called, when translations were added
* @return {Function} call to unsubscribe
*/
watchTranslationUpdate(callback?: Function): Function;
}