Skip to content

Commit 40ef60b

Browse files
juuz0kelson42
authored andcommitted
Display MUL on tile when multiple languages are available
If a book contains multiple languages, the language label now shows "MUL". On hover, it displays the list of all languages available in the ZIM.
1 parent d85eb1b commit 40ef60b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

static/skin/index.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,13 @@
131131
const title = getInnerHtml(book, 'title');
132132
const description = getInnerHtml(book, 'summary');
133133
const id = getInnerHtml(book, 'id');
134-
const langCode = getInnerHtml(book, 'language');
135-
const language = languages[langCode];
134+
const langCodesList = getInnerHtml(book, 'language').split(',');
135+
const langCode = langCodesList.length == 1 ? langCodesList[0] : 'mul';
136+
let language = languages[langCode];
137+
if (langCode == 'mul') {
138+
const mulLangList = langCodesList.filter(x => languages.hasOwnProperty(x)).map(x => languages[x]);
139+
language = mulLangList.join(',');
140+
}
136141
const tags = getInnerHtml(book, 'tags');
137142
const tagList = tags.split(';').filter(tag => {return !(tag.startsWith('_'))});
138143
const tagFilterLinks = tagList.map((tagValue) => generateTagLink(tagValue));

test/server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const ResourceCollection resources200Compressible{
6363
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/index.css" },
6464
{ STATIC_CONTENT, "/ROOT%23%3F/skin/index.css?cacheid=e4d76d16" },
6565
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/index.js" },
66-
{ STATIC_CONTENT, "/ROOT%23%3F/skin/index.js?cacheid=d38d9ef1" },
66+
{ STATIC_CONTENT, "/ROOT%23%3F/skin/index.js?cacheid=14e216fb" },
6767
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/iso6391To3.js" },
6868
{ STATIC_CONTENT, "/ROOT%23%3F/skin/iso6391To3.js?cacheid=ecde2bb3" },
6969
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/isotope.pkgd.min.js" },
@@ -288,7 +288,7 @@ R"EXPECTEDRESULT( href="/ROOT%23%3F/skin/index.css?cacheid=e4d76d16"
288288
<script type="text/javascript" src="/ROOT%23%3F/skin/languages.js?cacheid=b00b12db" defer></script>
289289
<script src="/ROOT%23%3F/skin/isotope.pkgd.min.js?cacheid=2e48d392" defer></script>
290290
<script src="/ROOT%23%3F/skin/iso6391To3.js?cacheid=ecde2bb3"></script>
291-
<script type="text/javascript" src="/ROOT%23%3F/skin/index.js?cacheid=d38d9ef1" defer></script>
291+
<script type="text/javascript" src="/ROOT%23%3F/skin/index.js?cacheid=14e216fb" defer></script>
292292
<img src="/ROOT%23%3F/skin/feed.svg?cacheid=055b333f"
293293
<img src="/ROOT%23%3F/skin/langSelector.svg?cacheid=00b59961"
294294
)EXPECTEDRESULT"

0 commit comments

Comments
 (0)