mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 09:02:01 +01:00
11 lines
419 B
JavaScript
11 lines
419 B
JavaScript
import acceptLanguage from 'accept-language'
|
|
export default function ({ req, app, store }) {
|
|
if (process.server) {
|
|
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
|
|
}
|
|
}
|