From 5a21c4d7f6a235c84a583555028fbcab61fe817f Mon Sep 17 00:00:00 2001 From: Julien Deniau Date: Thu, 6 Feb 2020 10:08:50 +0100 Subject: [PATCH 1/2] Fix "lang" selector in url location.search.match(/lang=([a-z]+)/) does return `['lang=fr', 'fr']` if it does match and thus does not found the language with the query parameter. This commit fixes this comportment --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index ad3b999..9ea00ff 100644 --- a/index.html +++ b/index.html @@ -286,7 +286,8 @@ } function trans(key) { - const queryLang = location.search.match(/lang=([a-z]+)/); + var matchLang = location.search.match(/lang=([a-z]+)/); + var queryLang = matchLang ? matchLang[1] : null; var locale = queryLang || navigator.language || navigator.userLanguage; var translations = getTranslations(); From 53f3b4b2c19db91dce2d7575ad56541f187c50ba Mon Sep 17 00:00:00 2001 From: Julien Deniau Date: Thu, 6 Feb 2020 10:10:06 +0100 Subject: [PATCH 2/2] tab vs spaces --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 9ea00ff..4d760ed 100644 --- a/index.html +++ b/index.html @@ -287,7 +287,7 @@ function trans(key) { var matchLang = location.search.match(/lang=([a-z]+)/); - var queryLang = matchLang ? matchLang[1] : null; + var queryLang = matchLang ? matchLang[1] : null; var locale = queryLang || navigator.language || navigator.userLanguage; var translations = getTranslations();