Currently I have this method in one of my .ts files:
clearFavourites() {
if (this.language === 'en') {
this.dialogs.confirm('Do you want to clear your favourite apps?', 'Clear Favourites', ['Yes', 'No'])
.then(val => {
console.log('Dialog dismissed' + val);
if (val === 1) {
this.resetFavIcons();
this.storage.remove('FavAppList');
this.storage.set('FavHasChanged', 'yes');
}
})
.catch(e =>
console.log('Error displaying dialog', e)
);
} else if (this.language === 'mt') {
this.dialogs.confirm('Trid tneħħi l-apps tiegħek mill-favoriti?', 'Neħħi minn Favoriti', ['Iva', 'Le'])
.then(val => {
console.log('Dialog dismissed' + val);
if (val === 1) {
this.resetFavIcons();
this.storage.remove('FavAppList');
this.storage.set('FavHasChanged', 'yes');
}
})
.catch(e =>
console.log('Error displaying dialog', e)
);
}
}
}
I already have ngx trasnlate installed and i am already using the translate pipe in html. I would like to use the same for this method to remove the if and else for checking the language and just have something similar to:
clearFavourites() {
this.dialogs.confirm('SettingsPage.RemoveFav' | translate, 'SettingsPage.ClearFav' | translate, ['SettingsPage.Yes' | translate, 'SettingsPage.No' | translate])
.then(val => {
console.log('Dialog dismissed' + val);
if (val === 1) {
this.resetFavIcons();
this.storage.remove('FavAppList');
this.storage.set('FavHasChanged', 'yes');
}
})
.catch(e =>
console.log('Error displaying dialog', e)
);
}
}
The above method is not working for me, is there another way I can use the ngx translate pipe in a .ts file similar to the method above?