I'm using angular-translate to provide dynamic language support for my app. I am also using a calendar component (http://angular-ui.github.io/ui-calendar/) which doesn't play that well with angular (jQuery roots). To be able to translate it at run time I need to detect when language changes.
Basically I need to know when $translate.use()
has been called and the language has been changed.
Is there a way to detect when the language changes so that I can trigger the translations for the calendar component?
This is how I solved it:
$rootScope.$on('$translateChangeSuccess', function(event, current, previous) {
// Language has changed
});
Another answer :
$scope.$watch("$parent.currentLanguage", function(newValue, oldValue) {
// Do whatever you want
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With