userlang query param is removed from the URL

If the userlang query param is present in the URL it is used to set the
UI language and then is removed from the URL.

Unlike the ZIM viewer, changing the UI language on the welcome page
isn't recorded in the navigation history (and probably it should work
the same way in the ZIM viewer where the appearance of the web page is
affected by the UI language changes to a significantly smaller extent).
This commit is contained in:
Veloman Yunkan 2023-02-09 18:04:47 +01:00
parent fbf6d97f5e
commit 763fb86ad0
2 changed files with 5 additions and 5 deletions

View File

@ -15,6 +15,7 @@
let noResultInjected = false;
let filters = getCookie(filterCookieName);
let params = new URLSearchParams(window.location.search || filters || '');
params.delete('userlang');
let timer;
let languages = {};
@ -34,9 +35,8 @@
function changeUILanguage() {
const s = document.getElementById("ui_language");
const lang = s.options[s.selectedIndex].value;
const q = new URLSearchParams(window.location.search);
q.set("userlang", lang);
location.search = q.toString();
setPermanentGlobalCookie('userlang', lang);
window.location.reload();
}
function queryUrlBuilder() {

View File

@ -63,7 +63,7 @@ const ResourceCollection resources200Compressible{
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/index.css" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/index.css?cacheid=ac5767d8" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/index.js" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/index.js?cacheid=f045ea14" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/index.js?cacheid=5b1775c2" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/iso6391To3.js" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/iso6391To3.js?cacheid=ecde2bb3" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/isotope.pkgd.min.js" },
@ -284,7 +284,7 @@ R"EXPECTEDRESULT( href="/ROOT%23%3F/skin/index.css?cacheid=ac5767d8"
<script type="text/javascript" src="/ROOT%23%3F/skin/languages.js?cacheid=fe100348" defer></script>
<script src="/ROOT%23%3F/skin/isotope.pkgd.min.js?cacheid=2e48d392" defer></script>
<script src="/ROOT%23%3F/skin/iso6391To3.js?cacheid=ecde2bb3"></script>
<script type="text/javascript" src="/ROOT%23%3F/skin/index.js?cacheid=f045ea14" defer></script>
<script type="text/javascript" src="/ROOT%23%3F/skin/index.js?cacheid=5b1775c2" defer></script>
<img src="/ROOT%23%3F/skin/feed.png?cacheid=56a672b1"
)EXPECTEDRESULT"
},