'Is there a way to watch a change of the i18n's current locale?

How can I call a function when the language/locale changes while using i18n?
Should I use Vuex or does vue-i18n has a method that allows me to do that?



Solution 1:[1]

You could watch $i18n.locale for any changes but usually, you do change this kind of thing. What is your use-case for such need ?

watch: {
  '$i18n.locale': function(newVal, oldVal) {
    console.log('locale change', newVal)
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kissu