Created
September 11, 2018 12:28
-
-
Save hesch/c77b0358b87815e7f0e946642cccb15c to your computer and use it in GitHub Desktop.
async translations angular 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
fetch('/api/test.de.xlf') | |
.then(res => res.text()) | |
.then(translations => { | |
platformBrowserDynamic().bootstrapModule(AppModule, | |
{ | |
providers: [ | |
{provide: TRANSLATIONS, useValue: translations}, | |
{provide: TRANSLATIONS_FORMAT, useValue: 'xlf'}, | |
] | |
}) | |
.catch(err => console.log(err)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment