diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index 7971840e6..876a5f7f6 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -462,6 +462,11 @@ std::string noSearchResultsMsg() return "The fulltext search engine is not available for this content."; } +ParameterizedMessage nonParameterizedMessage(const std::string& msgId) +{ + return ParameterizedMessage(msgId, {}); +} + } // unnamed namespace std::unique_ptr InternalServer::handle_suggest(const RequestContext& request) @@ -680,9 +685,8 @@ std::unique_ptr InternalServer::handle_random(const RequestContext& re auto entry = archive->getRandomEntry(); return build_redirect(bookName, getFinalItem(*archive, entry)); } catch(zim::EntryNotFound& e) { - const std::string error_details = "Oops! Failed to pick a random article :("; return HTTP404HtmlResponse(*this, request) - + error_details + + nonParameterizedMessage("random-article-failure") + TaskbarInfo(bookName, archive.get()); } } diff --git a/static/i18n/en.json b/static/i18n/en.json index 32ce8fa78..6c34ec729 100644 --- a/static/i18n/en.json +++ b/static/i18n/en.json @@ -8,4 +8,5 @@ , "no-such-book": "No such book: {{BOOK_NAME}}" , "url-not-found" : "The requested URL \"{{url}}\" was not found on this server." , "suggest-search" : "Make a full text search for {{PATTERN}}" + , "random-article-failure" : "Oops! Failed to pick a random article :(" } diff --git a/static/i18n/qqq.json b/static/i18n/qqq.json index 8d1195b40..cbf41ffaf 100644 --- a/static/i18n/qqq.json +++ b/static/i18n/qqq.json @@ -9,4 +9,5 @@ , "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" , "suggest-search" : "Suggest a search when the URL points to a non existing article" + , "random-article-failure" : "Failure of the random article selection procedure" }