diff --git a/src/server/response.cpp b/src/server/response.cpp index f87ffecb5..795ec7dc4 100644 --- a/src/server/response.cpp +++ b/src/server/response.cpp @@ -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) diff --git a/static/i18n/en.json b/static/i18n/en.json index 6a111b289..4b87abe0a 100644 --- a/static/i18n/en.json +++ b/static/i18n/en.json @@ -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." } diff --git a/static/i18n/qqq.json b/static/i18n/qqq.json index f0aaaa8dd..f62e435e1 100644 --- a/static/i18n/qqq.json +++ b/static/i18n/qqq.json @@ -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" }