• Overview
@angular/core

TRANSLATIONS

constant
stable

Use this token at bootstrap to provide the content of your translation file (xtb, xlf or xlf2) when you want to translate your application in another language.

API

  
    const TRANSLATIONS: InjectionToken<string>;
  
  

Description

Use this token at bootstrap to provide the content of your translation file (xtb, xlf or xlf2) when you want to translate your application in another language.

See the i18n guide for more information.

Usage Notes

Example

In standalone apps:

          
import { LOCALE_ID, ApplicationConfig } from '@angular/core';import { AppModule } from './app/app.module';const appConfig: ApplicationConfig = {  providers: [{provide: TRANSLATIONS, useValue: translations }]};

In module based apps:

          
import { TRANSLATIONS } from '@angular/core';import { platformBrowser } from '@angular/platform-browser';import { AppModule } from './app/app.module';// content of your translation fileconst translations = '....';platformBrowser().bootstrapModule(AppModule, {  providers: [{provide: TRANSLATIONS, useValue: translations }]});
Jump to details