Provides methods to access the translations.
class TranslationService {
constructor( http: HttpClient );
readonly activeLanguage: string;
readonly isDownloading: boolean;
readonly languageChanged: EventEmitter< string >;
readonly statusChange: EventEmitter< TranslationChange >;
initializeApp( config: TranslationConfig ): Promise< boolean >;
initializeSection( route: Route ): Promise< boolean >;
changeLanguage( language: string ): Promise< any >;
get( key: string, args?: any ): string;
getGroup( key: string ): object;
insert( key: string, text: string, args?: any ): string;
// localization helper methods:
number( value: number, options: string ): string;
percent( value: number, options: string ): string;
currency( value: CurrencyValue, options: string ): string;
ccy( value: number, currencyCode: string, options: string ): string;
datetime( value: Date | number | string, options: string ): string;
}
Creates a new instance of the service.
Gets the code of the current language.
Indicates that the download of one or more translation files is in progress.
Having changed the active language emits the code of the current language.
Indicates changes in the state of the translation service related to the downloads of the translation files.
Initializes the service and loads the translations of eager loaded modules for the default and active languages.
Returns a promise indicating whether the language of the browser is supported.
Loads the translations of a lazy loaded module for all languages already in use.
Returns a promise indicating whether loading has succeeded.
Sets the new active language and loads the translations of the language for all loaded modules.
Returns a promise.
Gets the text identified by the key in the current language. If the text contains placeholders for values, then they are replaced with the values provided by the second argument.
Returns the translated text.
Gets the translation node identified by the key in the current language.
Returns an object containing translated texts.
Replaces the placeholders in the translation text with the values provided by the second argument.
Returns the translated text.
Localization helper methods. See LocalizeContext.