I decided to implement custom loader for translations because I have an issue that string want to get translated before loader loads correct translations. I followed example on ngx-translate github but now everywhere I get keys instead of values. My custom loader:
class CustomLoader implements TranslateLoader {
getTranslation(lang: string): Observable<any> {
return Observable.of({ KEY: 'value' });
}
}
in app.module imports I have:
TranslateModule.forRoot({
loader: { provide: TranslateLoader, useClass: CustomLoader }
})
My translations are in ./assets/i18n/ and are all json. Anyone know what I need to change so loader will find my translations?
Try this
and then