ionicPopup and translation

Hi everybody,

I’m facing an issue using ionicPopup and angular-translate.
By using it in a controller.

$ionicPopup.confirm({
	  title: $translate('CANCEL_TICKET_TITLE'),
	  content: $translate('CANCEL_TICKET_MSG')
	}).then(function(res) { });

In this case when the popup is called, instead of the message translated, I’ve got an object:

Same trouble to translate buttons, is there a way or a workaround to translate the content, I know it’s not exactly an ionic trouble, but as internationalization of an application is a common goal, someone has probably already solved this kind of issue.
Any suggestion is welcome !
Thanks

If you are using angular translate then you have to work with promises. This one works:

$translate('successLoad').then(function (successLoadTranslated) {
              $ionicPopup.alert({
                content: successLoadTranslated,
                okType: 'button-calm'
              })

This should work too if you don’t want to use promises (but it doesn’t work with async loading).

$ionicPopup.confirm({
    title: $translate.instant('CANCEL_TICKET_TITLE'),
    template: $translate.instant('CANCEL_TICKET_MSG');
}).then(function(res) {});
6 Likes

Hi zbindenren,

Whaou! thank a lot for this quick and working answer.
I’m looking for chaining promises and translating all the contents of the popUp : title,content, and buttons.
I’m not comfortable with promises, just beginning to discover his “power”, if you’ve any suggestions, it will be greatly appreciate.
Anyway thank for your contribution. Regards

Hello ohh​2ahh,

Thank you, for your answer, I didn’t know the instant function of angular-translate, it’s easier to use in my case(didn’t use async loading).
Thank you all, for your valuable answers. Regards

Thanks for you comment @ohh2ahh!