Internationalized random article failure message

This commit is contained in:
Veloman Yunkan 2022-01-23 22:05:44 +04:00 committed by Matthieu Gautier
parent 52d4f73e89
commit ca7e0fb4a0
3 changed files with 8 additions and 2 deletions

View File

@ -462,6 +462,11 @@ std::string noSearchResultsMsg()
return "The fulltext search engine is not available for this content."; return "The fulltext search engine is not available for this content.";
} }
ParameterizedMessage nonParameterizedMessage(const std::string& msgId)
{
return ParameterizedMessage(msgId, {});
}
} // unnamed namespace } // unnamed namespace
std::unique_ptr<Response> InternalServer::handle_suggest(const RequestContext& request) std::unique_ptr<Response> InternalServer::handle_suggest(const RequestContext& request)
@ -680,9 +685,8 @@ std::unique_ptr<Response> InternalServer::handle_random(const RequestContext& re
auto entry = archive->getRandomEntry(); auto entry = archive->getRandomEntry();
return build_redirect(bookName, getFinalItem(*archive, entry)); return build_redirect(bookName, getFinalItem(*archive, entry));
} catch(zim::EntryNotFound& e) { } catch(zim::EntryNotFound& e) {
const std::string error_details = "Oops! Failed to pick a random article :(";
return HTTP404HtmlResponse(*this, request) return HTTP404HtmlResponse(*this, request)
+ error_details + nonParameterizedMessage("random-article-failure")
+ TaskbarInfo(bookName, archive.get()); + TaskbarInfo(bookName, archive.get());
} }
} }

View File

@ -8,4 +8,5 @@
, "no-such-book": "No such book: {{BOOK_NAME}}" , "no-such-book": "No such book: {{BOOK_NAME}}"
, "url-not-found" : "The requested URL \"{{url}}\" was not found on this server." , "url-not-found" : "The requested URL \"{{url}}\" was not found on this server."
, "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 :("
} }

View File

@ -9,4 +9,5 @@
, "no-such-book": "Error text when the requested book is not found in the library" , "no-such-book": "Error text when the requested book is not found in the library"
, "url-not-found" : "Error text about wrong URL for an HTTP 404 error" , "url-not-found" : "Error text about wrong URL for an HTTP 404 error"
, "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"
} }