Search code examples
vue.jsvuexnuxt.jsvue-i18n

Translating WebApp with vue-i18n without changing URL


What would be the best implementation of i18n. It's for a webapp so I don't want to update the url based on locale.

I am using nuxt frameworks so I researched nuxt-i18n but that's not possible without updating the url.


Solution

  • I tried to create a simple example, but we can still improve.

    In this approach, I tried to use cookies instead of the path, and to do so I need to make a refresh page when we switch languages or else our components wouldn't load the new translations.

    Check here: https://codesandbox.io/embed/example-i18n-mo8t7?fontsize=14