diff --git a/static/skin/i18n/en.json b/static/skin/i18n/en.json index bf8441fc1..e2ce7a463 100644 --- a/static/skin/i18n/en.json +++ b/static/skin/i18n/en.json @@ -28,4 +28,5 @@ , "random-page-button-text": "Go to a randomly selected page" , "searchbox-tooltip": "Search '{{BOOK_TITLE}}'" , "confusion-of-tongues": "Two or more books in different languages would participate in search, which may lead to confusing results." + , "welcome-page-overzealous-filter": "No result. Would you like to reset filter?" } diff --git a/static/skin/i18n/qqq.json b/static/skin/i18n/qqq.json index 2175d24a1..6a1c17236 100644 --- a/static/skin/i18n/qqq.json +++ b/static/skin/i18n/qqq.json @@ -29,5 +29,5 @@ "library-button-text": "Tooltip of the button leading to the welcome page", "home-button-text": "Tooltip of the button leading to the main page of a book", "random-page-button-text": "Tooltip of the button opening a randomly selected page", - "searchbox-tooltip": "Tooltip displayed for the search box" + , "welcome-page-overzealous-filter": "Text shown when book filtering on the welcome page produces zero results" } diff --git a/static/skin/i18n/test.json b/static/skin/i18n/test.json index a96eac241..bf8bd49f0 100644 --- a/static/skin/i18n/test.json +++ b/static/skin/i18n/test.json @@ -17,4 +17,5 @@ , "home-button-text": "[I18N TESTING] Jump to the main page of '{{BOOK_TITLE}}'" , "random-page-button-text": "[I18N TESTING] I am tired of determinism" , "searchbox-tooltip": "[I18N TESTING] Let's search in '{{BOOK_TITLE}}'" + , "welcome-page-overzealous-filter": "[I18N TESTING] Nothing found. Reset filter" } diff --git a/static/skin/index.js b/static/skin/index.js index 036e18516..9c7fe5613 100644 --- a/static/skin/index.js +++ b/static/skin/index.js @@ -298,7 +298,7 @@ const kiwixHomeBody = document.querySelector('.kiwixHomeBody'); const divTag = document.createElement('div'); divTag.setAttribute('class', 'noResults'); - divTag.innerHTML = `No result. Would you like to reset filter?`; + divTag.innerHTML = $t("welcome-page-overzealous-filter"); kiwixHomeBody.append(divTag); kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center'); loader.setAttribute('style', 'position: absolute; top: 50%'); @@ -462,7 +462,7 @@ } }); - window.onload = async () => { + async function onload() { iso = new Isotope( '.book__list', { itemSelector: '.book', getSortData:{ @@ -508,6 +508,13 @@ } updateFeedLink(); setCookie(filterCookieName, params.toString()); + }; + + // required by i18n.js:setUserLanguage() + window.setPermanentGlobalCookie = function(name, value) { + document.cookie = `${name}=${value};path=${root};max-age=31536000`; } + + window.onload = () => { setUserLanguage(getUserLanguage(), onload); } })(); diff --git a/static/templates/index.html b/static/templates/index.html index 0274e9a3a..f2a80342e 100644 --- a/static/templates/index.html +++ b/static/templates/index.html @@ -37,6 +37,7 @@ src: url("{{root}}/skin/fonts/Roboto.ttf?KIWIXCACHEID") format("truetype"); } + diff --git a/test/server.cpp b/test/server.cpp index 23f05135b..c0d3fa7a9 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -63,7 +63,7 @@ const ResourceCollection resources200Compressible{ { DYNAMIC_CONTENT, "/ROOT%23%3F/skin/index.css" }, { STATIC_CONTENT, "/ROOT%23%3F/skin/index.css?cacheid=316dbc21" }, { DYNAMIC_CONTENT, "/ROOT%23%3F/skin/index.js" }, - { STATIC_CONTENT, "/ROOT%23%3F/skin/index.js?cacheid=b0cc9d6b" }, + { STATIC_CONTENT, "/ROOT%23%3F/skin/index.js?cacheid=ffc9a141" }, { 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" }, @@ -280,9 +280,10 @@ R"EXPECTEDRESULT( href="/ROOT%23%3F/skin/index.css?cacheid=316dbc21" src: url("/ROOT%23%3F/skin/fonts/Poppins.ttf?cacheid=af705837") format("truetype"); src: url("/ROOT%23%3F/skin/fonts/Roboto.ttf?cacheid=84d10248") format("truetype"); + - + )EXPECTEDRESULT" },