mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Backend translates the search results page
Now the search results page is presented by the backend in the language controlled by the value of the `userlang` URL query parameter (or, if the latter is missing, the value of the `Accept-Language:` HTTP header). Note that the front-end doesn't yet take advantage of this functionality.
This commit is contained in:
@ -192,7 +192,6 @@ kainjow::mustache::data buildPagination(
|
||||
|
||||
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;
|
||||
// Build the results list
|
||||
kainjow::mustache::data items{kainjow::mustache::data::type::list};
|
||||
|
@ -967,6 +967,7 @@ std::unique_ptr<Response> InternalServer::handle_search_request(const RequestCon
|
||||
renderer.setProtocolPrefix(m_root + "/content/");
|
||||
renderer.setSearchProtocolPrefix(m_root + "/search");
|
||||
renderer.setPageLength(pageLength);
|
||||
renderer.setUserLang(request.get_user_language());
|
||||
if (request.get_requested_format() == "xml") {
|
||||
return ContentResponse::build(
|
||||
renderer.getXml(*mp_nameMapper, mp_library.get()),
|
||||
|
Reference in New Issue
Block a user