mirror of https://github.com/kiwix/libkiwix.git
Search results page title as translatable text
However it is NOT actually translated by the backend yet
This commit is contained in:
parent
795fcb9de4
commit
c4fa42f20b
|
@ -32,9 +32,23 @@
|
||||||
#include "libkiwix-resources.h"
|
#include "libkiwix-resources.h"
|
||||||
#include "tools/stringTools.h"
|
#include "tools/stringTools.h"
|
||||||
|
|
||||||
|
#include "server/i18n.h"
|
||||||
|
|
||||||
namespace kiwix
|
namespace kiwix
|
||||||
{
|
{
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
ParameterizedMessage searchResultsPageTitleMsg(const std::string& searchPattern)
|
||||||
|
{
|
||||||
|
return ParameterizedMessage("search-results-page-title",
|
||||||
|
{{"SEARCH_PATTERN", searchPattern}}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // unnamed namespace
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
SearchRenderer::SearchRenderer(zim::SearchResultSet srs,
|
SearchRenderer::SearchRenderer(zim::SearchResultSet srs,
|
||||||
unsigned int start, unsigned int estimatedResultCount)
|
unsigned int start, unsigned int estimatedResultCount)
|
||||||
|
@ -159,6 +173,7 @@ kainjow::mustache::data buildPagination(
|
||||||
|
|
||||||
std::string SearchRenderer::renderTemplate(const std::string& tmpl_str, const NameMapper& nameMapper, const Library* library)
|
std::string SearchRenderer::renderTemplate(const std::string& tmpl_str, const NameMapper& nameMapper, const Library* library)
|
||||||
{
|
{
|
||||||
|
const std::string userlang("en");
|
||||||
const std::string absPathPrefix = protocolPrefix;
|
const std::string absPathPrefix = protocolPrefix;
|
||||||
// Build the results list
|
// Build the results list
|
||||||
kainjow::mustache::data items{kainjow::mustache::data::type::list};
|
kainjow::mustache::data items{kainjow::mustache::data::type::list};
|
||||||
|
@ -199,11 +214,13 @@ std::string SearchRenderer::renderTemplate(const std::string& tmpl_str, const Na
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
kainjow::mustache::data allData;
|
const kainjow::mustache::object allData{
|
||||||
allData.set("searchProtocolPrefix", searchProtocolPrefix);
|
{"PAGE_TITLE", searchResultsPageTitleMsg(searchPattern).getText(userlang)},
|
||||||
allData.set("results", results);
|
{"searchProtocolPrefix", searchProtocolPrefix},
|
||||||
allData.set("pagination", pagination);
|
{"results", results},
|
||||||
allData.set("query", query);
|
{"pagination", pagination},
|
||||||
|
{"query", query},
|
||||||
|
};
|
||||||
|
|
||||||
kainjow::mustache::mustache tmpl(tmpl_str);
|
kainjow::mustache::mustache tmpl(tmpl_str);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
, "500-page-text": "An internal server error occured. We are sorry about that :/"
|
, "500-page-text": "An internal server error occured. We are sorry about that :/"
|
||||||
, "fulltext-search-unavailable" : "Fulltext search unavailable"
|
, "fulltext-search-unavailable" : "Fulltext search unavailable"
|
||||||
, "no-search-results": "The fulltext search engine is not available for this content."
|
, "no-search-results": "The fulltext search engine is not available for this content."
|
||||||
|
, "search-results-page-title": "Search: {{SEARCH_PATTERN}}"
|
||||||
, "library-button-text": "Go to welcome page"
|
, "library-button-text": "Go to welcome page"
|
||||||
, "home-button-text": "Go to the main page of '{{BOOK_TITLE}}'"
|
, "home-button-text": "Go to the main page of '{{BOOK_TITLE}}'"
|
||||||
, "random-page-button-text": "Go to a randomly selected page"
|
, "random-page-button-text": "Go to a randomly selected page"
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
"500-page-text": "Text of the 500 error page",
|
"500-page-text": "Text of the 500 error page",
|
||||||
"fulltext-search-unavailable": "Title of the error page returned when search is attempted in a book without fulltext search database",
|
"fulltext-search-unavailable": "Title of the error page returned when search is attempted in a book without fulltext search database",
|
||||||
"no-search-results": "Text of the error page returned when search is attempted in a book without fulltext search database",
|
"no-search-results": "Text of the error page returned when search is attempted in a book without fulltext search database",
|
||||||
|
"search-results-page-title": "Title of the search results page",
|
||||||
"library-button-text": "Tooltip of the button leading to the welcome page",
|
"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",
|
"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",
|
"random-page-button-text": "Tooltip of the button opening a randomly selected page",
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<title>Search: {{query.pattern}}</title>
|
<title>{{PAGE_TITLE}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body bgcolor="white">
|
<body bgcolor="white">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
|
Loading…
Reference in New Issue