fixes #7, add es locale

This commit is contained in:
les
2019-09-05 13:46:40 +02:00
parent b755f940d7
commit cd95c7eb3b
5 changed files with 218 additions and 7 deletions

View File

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