docs(aio): updated i18n guide and example (#19975)
This commit is contained in:

committed by
Victor Berchet

parent
3db7112b89
commit
132c0719dc
22
aio/content/examples/i18n/doc-files/main.2.ts
Normal file
22
aio/content/examples/i18n/doc-files/main.2.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// #docregion
|
||||
import { enableProdMode, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
// use the require method provided by webpack
|
||||
declare const require;
|
||||
// we use the webpack raw-loader to return the content as a string
|
||||
const translations = require(`raw-loader!./locale/messages.fr.xlf`);
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule, {
|
||||
providers: [
|
||||
{provide: TRANSLATIONS, useValue: translations},
|
||||
{provide: TRANSLATIONS_FORMAT, useValue: 'xlf'}
|
||||
]
|
||||
});
|
Reference in New Issue
Block a user