Use this tag for questions related to Nuxt.js Internationalization plugin based on Vue-i18n plugin.
Questions tagged [nuxt-i18n]
149 questions
20
votes
6 answers
Push a route (Moving from vueJS to nuxtJS)
I am converting a VueJS project to Nuxt.js and I have a problem understanding how nuxt handles routing. Its documentation doesn't say anything about Pushing a route.
Using VueJS I have the following in a component.
//template
user9801251
16
votes
1 answer
Can I access nuxt context in nuxt.config.js?
I'm using nuxt-i18n and @nuxtjs/auth and I want to config the auth.redirect option to support i18n like this:
// nuxt.config.js
export default {
modules: [
'@nuxtjs/auth',
'nuxt-i18n',
// ...
],
auth: {
redirect: {
home:…

STEN
- 433
- 1
- 6
- 15
11
votes
3 answers
Nuxt-i18n: how to load messages asynchronously?
I am building a multilingual Nuxt web app.
Using this example from the official documentation (Codepen link), I no longer want to use local JSON files where my translations are saved to work as defined in the code below:
messages: {
'en':…

Billal Begueradj
- 20,717
- 43
- 112
- 130
7
votes
2 answers
NuxtJS i18n [vue-router] Route with name about_us___en does not exist
Im using nuxtjs 2.10.x and i18n module. Nu custom middleware or anything like that. The routing is working fine.
my nuxt.config.js modules/i18n part:
...
modules:…

Shirker
- 1,233
- 2
- 18
- 30
7
votes
3 answers
Setting the language attribute when using i18n and Nuxt?
With Nuxt, you can set the language HTML attribute inside the nuxt.config.js file like so:
module.exports = {
head: {
htmlAttrs: {
lang: 'en-GB',
},
... etc etc
However, what should you do if you have a multi-language app? Is there any…

JMK
- 27,273
- 52
- 163
- 280
6
votes
0 answers
Vuex-Persistedstate run mutation on reload
I'm using Nuxt 2, Vue 2, Vuex 3, Vuetify 2, vuex-persistedstate 4 and nuxt-i18n 6.
I set this plugin to persiste my Vuex state which is containing RTL status and language code:
plugins/persistedState.client.js:
import createPersistedState from…

M.A. Heshmat Khah
- 740
- 12
- 27
6
votes
1 answer
How to generate localized dynamic routes with nuxt and nuxt-i18n?
I'm trying to make nuxt generate localized dynamic routes. I used nuxt-i18n to translate each route.
Here is my nuxt-i18n configuation:
['nuxt-i18n', {
lazy: true,
locales: [
{
name: 'French',
code: 'fr',
iso: 'fr-ch',
…

Thibaut Maurice
- 477
- 1
- 8
- 17
5
votes
2 answers
Multilingual site on Nuxt + Laravel with locales from backend
I am making a multilingual site on Nuxt + Laravel. I want to have an option to set locales in the database and share these locales to Nuxt front. Is it possible?
I found Nuxt plugin nuxt-i18n which looks good, but locales are set in nuxt.config.js…

niQitos
- 89
- 1
- 8
5
votes
2 answers
nuxt i18n routing not working for sub pages
I have changed my app to make it work with nuxt i18n and the translation seems to work when I access the routes directly.
E.g. http://localhost:3000/fr/step/1
I have the following structure in my app and each step is one page with different…

grindking
- 917
- 5
- 13
- 29
4
votes
0 answers
nuxt i18n not working in IE throwing SCRIPT1006: Expected ')'
I am trying to make the nuxt-i18n work for IE document mode 11.
SCRIPT1006: Expected ')'
I have seen from this link that nuxt-i18n fixed the issue in 6.23.0 version related to a script error ,
https://github.com/nuxt-modules/i18n/issues/329
but…

Bravo
- 61
- 2
- 7
- 26
4
votes
1 answer
Nuxt3 & Nuxt I18n Plugin doesn't detect Browser language preference & Deployement issue
Actually working with Nuxt3 RC Documentation and it's dedicated plugin Nuxt/I18n Documentation
I encountered two issues:
First issue is that I'm failing to detect Browser preference language it always fallback on the default local and I saw that the…

Stephane
- 43
- 4
4
votes
4 answers
[Nuxt, i18n, Vuex]: How to access this.$i18n.locales from store getter
I'm building a web app using Nuxt v2.15 and @nuxtjs/i18n v7.2. I'm using Vuex for state management. In my global state, I want to create a getter that returns a value based on this.$i18n.locale.
What is the best way to access the current app…

Shaun Scovil
- 3,905
- 5
- 39
- 58
4
votes
2 answers
Cannot read property '$options' of undefined making external js file for head options
I need to set up global head in Nuxt for my app, which some subpages will overwrite. Those global head needs to contain translated data.
I created seoHead.js file with code:
import Vue from "vue";
export const $t = (sign) =>…

BobiDaHombre
- 193
- 1
- 4
- 19
4
votes
1 answer
nuxt-i18n Strategy:no_prefix
I'm trying to use nuxt-i18n to get internationalization for my application, the following are the nuxt-i18n configs and it works fine, but when I want to use strategy: 'no_prefix' it gives errors ... not sure what to do, please suggest.
i18n: {
…

Surya Chandra Rao Gandreddi
- 546
- 7
- 16
4
votes
2 answers
Use same page for multiple routes
I am trying to find out how to use the same page for multiple routes on a Nuxt.js with i18n module.
Basically I want this route: /product-category/:slug/in/:material to use the same page as /product-category/:slug
So far I have tried below, adding…

FooBar
- 5,752
- 10
- 44
- 93