I'm loading the translation files from the server using TranslateHttpLoader in my app.module.ts like this:
export function createTranslateLoader(http: Http) {
return new TranslateHttpLoader(http, AppConfig.API_URL+'/static/i18n/', '.json');
}
@NgModule({
...
imports: [
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [Http]
}
}),
],
...
})
Everything works fine, but i'm wondering if there is a way to catch event when the loader fails to retrieve the language file for whatever reason (server issues, net con etc.) and possibly load a local json file with some default translation strings?
I want to catch this event if the app on the first load fails to grab the language file , and fallback to minimal local json file to just display translated mainetnance page/error page or something.