1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-25 21:16:38 +03:00

translate: Auto-detect the local browser language

Fixes #2537
This commit is contained in:
Frank LENORMAND 2018-11-21 13:24:13 +03:00
parent 775575958b
commit 9a6c39cac8

View File

@ -124,8 +124,12 @@
});
// Remember the language selected across page loads
// or auto-detect it according to the curently set browser language
var local_lang = (navigator.language || navigator.userLanguage).replace(/-.+$/, "");
var stored_lang = window.localStorage.getItem("translation-lang");
if (stored_lang in translations && stored_lang !== translation_lang) {
translate_to_lang(stored_lang);
} else if (local_lang) {
translate_to_lang(local_lang);
}
})();