From 33f04598837f35bf3e386d754ffd592823d57ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 20 Jan 2022 13:31:43 +0100 Subject: [PATCH] Get browser language --- webapp/plugins/i18n.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webapp/plugins/i18n.js b/webapp/plugins/i18n.js index 44005db62..b396a789e 100644 --- a/webapp/plugins/i18n.js +++ b/webapp/plugins/i18n.js @@ -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) {