TRANSLATIONS
当你想用另一种语言翻译应用程序时,可以在引导程序中使用此令牌来提供翻译文件的内容( xtb
、xlf
或 xlf2
)
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.
const TRANSLATIONS: InjectionToken<string>;
说明
有关更多信息,请参见《i18n 指南》。
See the i18n guide for more information.
Further information available in the Usage Notes...
使用说明
例子
Example
import { TRANSLATIONS } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
// content of your translation file
const translations = '....';
platformBrowserDynamic().bootstrapModule(AppModule, {
providers: [{provide: TRANSLATIONS, useValue: translations }]
});