Hey guys I am having trouble translating text in ts files like alerts and pops ups using ng-2 translate. I am already done translating HTML and that was very straightforward but i am stuck now, Let’s say for example, my code is this:
showAlert() {
let alert = this.alertCtrl.create({
title: ‘Confirmed’,
subTitle: this.ride.type == “rider” ? ‘Your ride request has been created.’ : ‘Your ride offer has been created.’,
buttons: [{
text: ‘Ok’,
handler: () => {
alert.dismiss()
.then(()=>{
this.navCtrl.pop();
})
return false;
}
}]
});
alert.present();
}
}
How can I translate the title and subtitle? I already have keys and the corresponding translated text in the json files but i dont know how to syntactically do it here. In the html files it was just {{KEY | translate}} but not sure what its gonna be here. Any help would be appreciated, thanks!!