mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 16:08:47 +03:00
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
This commit is contained in:
parent
89d45ef14f
commit
5a21c4d7f6
@ -286,7 +286,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function trans(key) {
|
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 locale = queryLang || navigator.language || navigator.userLanguage;
|
||||||
var translations = getTranslations();
|
var translations = getTranslations();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user