mirror of https://github.com/kiwix/libkiwix.git
Translated a hard-coded error message
This commit is contained in:
parent
f8aae395f3
commit
3188b0afe6
|
@ -239,8 +239,7 @@ HTTPErrorResponse& HTTP400Response::operator+(InvalidUrlMsg /*unused*/)
|
||||||
if (!query.empty()) {
|
if (!query.empty()) {
|
||||||
requestUrl += "?" + encodeDiples(query);
|
requestUrl += "?" + encodeDiples(query);
|
||||||
}
|
}
|
||||||
kainjow::mustache::mustache msgTmpl(R"(The requested URL "{{{url}}}" is not a valid request.)");
|
return *this + ParameterizedMessage("invalid-request", {{"url", requestUrl}});
|
||||||
return *this + msgTmpl.render({"url", requestUrl});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HTTP500Response::HTTP500Response(const InternalServer& server,
|
HTTP500Response::HTTP500Response(const InternalServer& server,
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
, "suggest-search" : "Make a full text search for <a href=\"{{{SEARCH_URL}}}\">{{PATTERN}}</a>"
|
, "suggest-search" : "Make a full text search for <a href=\"{{{SEARCH_URL}}}\">{{PATTERN}}</a>"
|
||||||
, "random-article-failure" : "Oops! Failed to pick a random article :("
|
, "random-article-failure" : "Oops! Failed to pick a random article :("
|
||||||
, "invalid-raw-data-type" : "{{DATATYPE}} is not a valid request for raw content."
|
, "invalid-raw-data-type" : "{{DATATYPE}} is not a valid request for raw content."
|
||||||
|
, "invalid-request" : "The requested URL \"{{{url}}}\" is not a valid request."
|
||||||
, "no-value-for-arg": "No value provided for argument {{ARGUMENT}}"
|
, "no-value-for-arg": "No value provided for argument {{ARGUMENT}}"
|
||||||
, "no-query" : "No query provided."
|
, "no-query" : "No query provided."
|
||||||
, "raw-entry-not-found" : "Cannot find {{DATATYPE}} entry {{ENTRY}}"
|
, "raw-entry-not-found" : "Cannot find {{DATATYPE}} entry {{ENTRY}}"
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"suggest-search": "Suggest a search when the URL points to a non existing article",
|
"suggest-search": "Suggest a search when the URL points to a non existing article",
|
||||||
"random-article-failure": "Failure of the random article selection procedure",
|
"random-article-failure": "Failure of the random article selection procedure",
|
||||||
"invalid-raw-data-type": "Invalid DATATYPE was used with the /raw endpoint (/raw/<book>/DATATYPE/...); allowed values are 'meta' and 'content'",
|
"invalid-raw-data-type": "Invalid DATATYPE was used with the /raw endpoint (/raw/<book>/DATATYPE/...); allowed values are 'meta' and 'content'",
|
||||||
|
"invalid-request" : "Error text for malformed URLs.",
|
||||||
"no-value-for-arg": "Error text when no value has been provided for ARGUMENT in the request's query string",
|
"no-value-for-arg": "Error text when no value has been provided for ARGUMENT in the request's query string",
|
||||||
"no-query": "Error text when no query has been provided for fulltext search",
|
"no-query": "Error text when no query has been provided for fulltext search",
|
||||||
"raw-entry-not-found": "Entry requested via the /raw endpoint was not found",
|
"raw-entry-not-found": "Entry requested via the /raw endpoint was not found",
|
||||||
|
|
|
@ -40,4 +40,6 @@
|
||||||
, "download-links-heading": "[I18N] Download links for <b><i>{{BOOK_TITLE}}</i></b> [TESTING]"
|
, "download-links-heading": "[I18N] Download links for <b><i>{{BOOK_TITLE}}</i></b> [TESTING]"
|
||||||
, "download-links-title": "[I18N TESTING]Download book"
|
, "download-links-title": "[I18N TESTING]Download book"
|
||||||
, "preview-book": "[I18N] Preview [TESTING]"
|
, "preview-book": "[I18N] Preview [TESTING]"
|
||||||
|
, "no-query" : "[I18N TESTING] Kiwix can read your thoughts but it is against GDPR. Please provide your query explicitly."
|
||||||
|
, "invalid-request" : "[I18N TESTING] Invalid URL: \"{{{url}}}\""
|
||||||
}
|
}
|
||||||
|
|
|
@ -927,6 +927,19 @@ TEST_F(ServerTest, Http400HtmlError)
|
||||||
Too many books requested (4) where limit is 3
|
Too many books requested (4) where limit is 3
|
||||||
</p>
|
</p>
|
||||||
)" },
|
)" },
|
||||||
|
|
||||||
|
// Testing of translation
|
||||||
|
{ /* url */ "/ROOT%23%3F/search?content=zimfile&userlang=test",
|
||||||
|
expected_page_title=="[I18N TESTING] Invalid request ($400 fine must be paid)" &&
|
||||||
|
expected_body==R"(
|
||||||
|
<h1>[I18N TESTING] -400 karma for an invalid request</h1>
|
||||||
|
<p>
|
||||||
|
[I18N TESTING] Invalid URL: "/ROOT%23%3F/search?content=zimfile&userlang=test"
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
[I18N TESTING] Kiwix can read your thoughts but it is against GDPR. Please provide your query explicitly.
|
||||||
|
</p>
|
||||||
|
)" },
|
||||||
};
|
};
|
||||||
|
|
||||||
for ( const auto& t : testData ) {
|
for ( const auto& t : testData ) {
|
||||||
|
|
Loading…
Reference in New Issue