0👍
✅
The correct and well-working way was to do the following:
- Define a reactive variable in the
$locale
service calledcurrentLocale
- Update the contents of this value when the user changes their preferred locale
- Reference this value in the
$t
function
And voila, Vue reactivity makes sure every call to $t
is updated whenever currentLocale
changes. No need for dirty hacks with $forceUpdate
.
Source:stackexchange.com