user locale, favicon

This commit is contained in:
lesion
2019-07-24 21:26:56 +02:00
parent 96e0a0b57c
commit 4b1aff3862
9 changed files with 51 additions and 28 deletions

View File

@@ -1,6 +1,10 @@
import acceptLanguage from 'accept-language'
export default function ({ req, app, store }) {
if (process.server) {
const lang = req.acceptsLanguages('en', 'it')
const acceptedLanguages = req.headers['accept-language']
const supportedLanguages = ['en', 'it']
acceptLanguage.languages(supportedLanguages)
const lang = acceptLanguage.get(acceptedLanguages)
store.commit('setLocale', lang || 'it')
app.i18n.locale = store.state.locale
}