question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[vue-i18n] Layout messages doesn't update when locale is switched

See original GitHub issue

Versions:

  • @inertiajs/inertia version: 0.9.2
  • @inertiajs/inertia-vue version: 0.6.2
  • vue-i18n version: 8.26.7

Describe the problem:

When I use layout: {Layout}, translation messages are not updated in layout file, but when I use components: {Layout} and manually wrap with <layout></layout> in every single page, messages are updated.

Steps to reproduce:

  • Use layout as layout: {Layout} (or even make it global in resolve, it doesn’t matter)
  • Install vue-i18n package
  • Configure it according to the official docs
  • Copy-paste locale switching example from official docs

Only page’s (<slot/>) messages will be updated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
claudiodekkercommented, Dec 2, 2021

In that case, I recommend you to ask your question in our Discord, as a GitHub Discussions topic, or perhaps even over at the Laracasts forums, as those places are more suitable compared to the issue tracker, as well as that there’s many others (especially on our Discord) that might be able to help with this 👍

0reactions
kenan-receblicommented, Dec 1, 2021

Another thing you could try in your layout is to ‘watch’ for a prop change, and then do a this.$forceUpdate() to force Vue to re-render that layout component.

I have tried this.$forceUpdate() before opening this issue, but it didn’t help. Anyway, thanks! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data not updating properly on i18n lang switch
$i18n.messages with the translations, then switch the locale of $i18n and only then change the slug in the route (i.e. navigate to the...
Read more >
Locale changing | Vue I18n
⚠️ Changing $i18n. locale inside a component does not update the root locale. If you rely on the root locale, for example when...
Read more >
Formatting is broken when switching language · Issue #983
When I use translation strings in a template and I switch locale, I expect the strings to be formatted in the chosen locale....
Read more >
The Ultimate Vue Localization Guide
Dive into Vue localization and learn how to plug the Vue I18n library into your app, so you can make it accessible to...
Read more >
Vue i18n: Building a multi-language app with locale switcher
Switching the locale. Integrating Vue Router and making it work with multiple locales. Lazy load translation files based on the chosen locale.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found