mulLanguages;
+ langShortString = "mul";
+ for (const auto& lang : bookLanguages) {
+ const std::string fullLang = getLanguageSelfName(lang);
+ mulLanguages.push_back(fullLang);
+ }
+ langFullString = kiwix::join(mulLanguages, ",");
+ } else if(bookLanguages.size() == 1) {
+ langShortString = bookLanguages[0];
+ langFullString = getLanguageSelfName(langShortString);
+ }
+
+ kainjow::mustache::object langTag;
+ langTag["langShortString"] = langShortString;
+ langTag["langFullString"] = langFullString;
+ return langTag;
+}
+
kainjow::mustache::list getTagList(std::string tags)
{
const auto tagsList = kiwix::split(tags, ";", true, false);
@@ -72,17 +96,16 @@ std::string HTMLDumper::dumpPlainHTML(kiwix::Filter filter) const
contentId = urlEncode(nameMapper->getNameForId(bookId));
} catch (...) {}
const auto bookDescription = bookObj.getDescription();
- const auto langCode = bookObj.getCommaSeparatedLanguages();
const auto bookIconUrl = rootLocation + "/catalog/v2/illustration/" + bookId + "/?size=48";
const auto tags = bookObj.getTags();
const auto downloadAvailable = (bookObj.getUrl() != "");
+ const auto langTagObj = getLangTag(bookObj.getLanguages());
std::string faviconAttr = "style=background-image:url(" + bookIconUrl + ")";
-
booksData.push_back(kainjow::mustache::object{
{"id", contentId},
{"title", bookTitle},
{"description", bookDescription},
- {"langCode", langCode},
+ {"langTag", langTagObj},
{"faviconAttr", faviconAttr},
{"tagList", getTagList(tags)},
{"downloadAvailable", downloadAvailable}
diff --git a/src/tools/stringTools.h b/src/tools/stringTools.h
index 97fa3473..4ddbfd6b 100644
--- a/src/tools/stringTools.h
+++ b/src/tools/stringTools.h
@@ -66,6 +66,9 @@ std::string ucAll(const std::string& word);
std::string lcAll(const std::string& word);
std::string ucFirst(const std::string& word);
std::string lcFirst(const std::string& word);
+
+/* This function is broken, related Github issue
+ * https://github.com/kiwix/libkiwix/issues/1188 */
std::string toTitle(const std::string& word);
std::string normalize(const std::string& word);
diff --git a/static/templates/no_js_library_page.html b/static/templates/no_js_library_page.html
index dd34a9b7..aaf61fa7 100644
--- a/static/templates/no_js_library_page.html
+++ b/static/templates/no_js_library_page.html
@@ -118,7 +118,7 @@