Recently I upgraded the Ionic and now its Ionic3
Now the current application does not work with Ionic and ng2-translate altogether.
The same code was working fine earlier without lazy loading, but we need to use lazy loading as to improve application loading time and reduce splash shown duration.
The app.module.ts import component looks like
TranslateModule.forRoot({
provide: TranslateLoader,
useClass: TMATranslationLoader
})
TMATranslationLoader looks like
export class TMATranslationLoader implements TranslateLoader {
constructor( ) { }
getTranslation(lang: string): Observable<any> {
switch(lang) {
case 'nl':
return Observable.of(translations_nl);
case 'hi':
return Observable.of(translations_hi);
// case 'de':
// return Observable.of(translations_de);
// case 'fr':
// return Observable.of(translations_fr);
// case 'es':
// return Observable.of(translations_es);
default:
return Observable.of(translations_en);
}
}
}
app.component.ts looks like
this.rootPage = 'LoginPage';
login-page.html looks like
<ion-label floating>{{ 'LBL_USERNAME' | translate }}</ion-label>
The run time exception which is trown
Error: Uncaught (in promise): Error: Template parse errors:
The pipe 'translate' could not be found (" <ion-list>
<ion-item class="icon-user">
<ion-label floating>{{ [ERROR ->]'LBL_USERNAME' | translate }}</ion-label>
Any idea? Did I do something wrong?