mirror of https://github.com/kiwix/libkiwix.git
URL-not-found message went into i18n JSON resource
Yet, the URL-not-found message is not yet fully internationalized since its usage is hardcoded to English.
This commit is contained in:
parent
577b6e29f9
commit
202ec81d8b
|
@ -21,6 +21,7 @@
|
|||
#include "request_context.h"
|
||||
#include "internalServer.h"
|
||||
#include "kiwixlib-resources.h"
|
||||
#include "i18n.h"
|
||||
|
||||
#include "tools/regexTools.h"
|
||||
#include "tools/stringTools.h"
|
||||
|
@ -131,8 +132,12 @@ HTTP404HtmlResponse::HTTP404HtmlResponse(const InternalServer& server,
|
|||
HTTPErrorHtmlResponse& HTTP404HtmlResponse::operator+(UrlNotFoundMsg /*unused*/)
|
||||
{
|
||||
const std::string requestUrl = m_request.get_full_url();
|
||||
kainjow::mustache::mustache msgTmpl(R"(The requested URL "{{url}}" was not found on this server.)");
|
||||
return *this + msgTmpl.render({"url", requestUrl});
|
||||
const auto urlNotFoundMsg = i18n::expandParameterizedString(
|
||||
"en", // FIXME: hardcoded language
|
||||
"url-not-found",
|
||||
{{"url", requestUrl}}
|
||||
);
|
||||
return *this + urlNotFoundMsg;
|
||||
}
|
||||
|
||||
HTTPErrorHtmlResponse& HTTPErrorHtmlResponse::operator+(const std::string& msg)
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
},
|
||||
"name":"English",
|
||||
"suggest-full-text-search": "containing '{{{SEARCH_TERMS}}}'..."
|
||||
, "url-not-found" : "The requested URL \"{{url}}\" was not found on this server."
|
||||
}
|
||||
|
|
|
@ -6,4 +6,5 @@
|
|||
},
|
||||
"name": "Current language to which the string is being translated to.",
|
||||
"suggest-full-text-search": "Text appearing in the suggestion list that, when selected, runs a full text search instead of the title search"
|
||||
, "url-not-found" : "Error text about wrong URL for an HTTP 404 error"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue