mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Fixed userlang control on the library page too
This fix contains a small hack - in order to detect the default language from browser language preference during the first visit, the library page has to load /viewer_settings.js which contains that information.
This commit is contained in:
@ -46,7 +46,7 @@
|
||||
window.modalUILanguageSelector.close();
|
||||
const s = document.getElementById("ui_language");
|
||||
const lang = s.options[s.selectedIndex].value;
|
||||
setPermanentGlobalCookie('userlang', lang);
|
||||
localStorage.setItem('userlang', lang);
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
@ -585,11 +585,6 @@
|
||||
setInterval(updateNavVisibilityState, 250);
|
||||
};
|
||||
|
||||
// required by i18n.js:setUserLanguage()
|
||||
window.setPermanentGlobalCookie = function(name, value) {
|
||||
document.cookie = `${name}=${value};path=${root};max-age=31536000`;
|
||||
}
|
||||
|
||||
window.onload = () => { setUserLanguage(getUserLanguage(), onload); }
|
||||
})();
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
src: url("{{root}}/skin/fonts/Roboto.ttf?KIWIXCACHEID") format("truetype");
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="./viewer_settings.js"></script>
|
||||
<script type="module" src="{{root}}/skin/i18n.js?KIWIXCACHEID" defer></script>
|
||||
<script type="text/javascript" src="{{root}}/skin/languages.js?KIWIXCACHEID" defer></script>
|
||||
<script src="{{root}}/skin/isotope.pkgd.min.js?KIWIXCACHEID" defer></script>
|
||||
|
Reference in New Issue
Block a user