add i18n middlware
This commit is contained in:
7
middleware/i18n.js
Normal file
7
middleware/i18n.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export default function ({ req, app, store }) {
|
||||||
|
if (process.server) {
|
||||||
|
const lang = req.acceptsLanguages('en', 'it')
|
||||||
|
store.commit('setLocale', lang || 'it')
|
||||||
|
app.i18n.locale = store.state.locale
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user