Get browser language

This commit is contained in:
Wolfgang Huß 2022-01-20 13:31:43 +01:00
parent d491c1bad6
commit 33f0459883

View File

@ -22,7 +22,10 @@ export default ({ app, req, cookie, store }) => {
if (process.server) return
const newLocale = mutation.payload.locale
const currentLocale = await app.$cookies.get(key)
let currentLocale = await app.$cookies.get(key)
if (!currentLocale) {
currentLocale = navigator.language.split('-')[0] // get browser language
}
const isDifferent = newLocale !== currentLocale
if (!isDifferent) {