fix user_locale and favicon

This commit is contained in:
les
2019-09-19 16:23:46 +02:00
parent f08273aa10
commit 3a59b54a79
6 changed files with 38 additions and 21 deletions

View File

@@ -1,12 +1,13 @@
import acceptLanguage from 'accept-language'
// import acceptLanguage from 'accept-language'
export default async function ({ req, app, store }) {
if (process.server) {
const acceptedLanguages = req.headers['accept-language']
const supportedLanguages = ['en', 'it', 'es']
acceptLanguage.languages(supportedLanguages)
const lang = acceptLanguage.get(acceptedLanguages)
store.commit('setLocale', lang || 'it')
app.i18n.locale = store.state.locale
}
}
// export default async function ({ req, app, store }) {
// // if (process.server) {
// // const acceptedLanguages = req.headers['accept-language']
// // const supportedLanguages = ['en', 'it', 'es']
// // acceptLanguage.languages(supportedLanguages)
// // const lang = acceptLanguage.get(acceptedLanguages)
// // store.commit('setLocale', lang || 'it')
// // app.i18n.locale = store.state.locale
// // console.error('INSIDE MIDDLEWARE i18n settings locale ', lang)
// // }
// }