From 9119b24095a9dd58cd270c6c8b77b6c92314a170 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 24 Oct 2019 13:15:25 +0200 Subject: [PATCH] Save last forced language --- src/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.js b/src/main.js index 763b65e..fa20324 100644 --- a/src/main.js +++ b/src/main.js @@ -43,8 +43,13 @@ const localePath = window.location.pathname .replace(/^\//, '') .replace(/\/$/, '') +const languageFromLocalStorage = localStorage.getItem('language') + if (allLocales.includes(localePath)) { Vue.config.language = aliasesLanguages[localePath] ? aliasesLanguages[localePath] : localePath + localStorage.setItem('language', Vue.config.language) +} else if (languageFromLocalStorage) { + Vue.config.language = languageFromLocalStorage } else { const navigatorLanguage = window.navigator.userLanguage || window.navigator.language const snakeCaseLanguage = navigatorLanguage.replace('-', '_')