Skip to content
Advertisement

Nuxt.js i18n localization doesn’t work in SPA mode

I developed project Nuxt.js in universal mode and localized with i18n work fine, but now I want to change to in spa mode but i18n doesn’t change the language. this is code. file : nuxt.config.js

JavaScript

file : middleware/i18n.js

JavaScript

store/index.js

JavaScript

and licalize file are in locales/fa.json and en.json

Advertisement

Answer

export default function ({ isHMR, app, store, route, params, req, error, redirect })

So bold parameter req is not receive in SAP mode. For more information you can visit this link.

So you have to try another way using another parameter, Just for example you can see below code:

JavaScript
Advertisement