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?
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?
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)
}
}