Localized "No such book" 404 message for /random

However the title and the heading of the 404 page are not localized yet.
This commit is contained in:
Veloman Yunkan 2022-03-24 19:33:56 +04:00 committed by Matthieu Gautier
parent b2526c7a98
commit cb5ae01fd8
5 changed files with 13 additions and 2 deletions

View File

@ -452,9 +452,9 @@ std::string makeFulltextSearchSuggestion(const std::string& lang, const std::str
);
}
std::string noSuchBookErrorMsg(const std::string& bookName)
ParameterizedMessage noSuchBookErrorMsg(const std::string& bookName)
{
return "No such book: " + bookName;
return ParameterizedMessage("no-such-book", { {"BOOK_NAME", bookName} });
}
std::string noSearchResultsMsg()

View File

@ -5,5 +5,6 @@
},
"name":"English",
"suggest-full-text-search": "containing '{{{SEARCH_TERMS}}}'..."
, "no-such-book": "No such book: {{BOOK_NAME}}"
, "url-not-found" : "The requested URL \"{{url}}\" was not found on this server."
}

View File

@ -5,5 +5,6 @@
},
"name":"Հայերեն",
"suggest-full-text-search": "որոնել '{{{SEARCH_TERMS}}}'..."
, "no-such-book": "Գիրքը բացակայում է՝ {{BOOK_NAME}}"
, "url-not-found" : "Սխալ հասցե՝ {{url}}"
}

View File

@ -6,5 +6,6 @@
},
"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"
, "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"
}

View File

@ -571,6 +571,14 @@ TEST_F(ServerTest, 404WithBodyTesting)
</p>
)" },
{ /* url */ "/ROOT/random?content=non-existent-book&userlang=hy",
expected_body==R"(
<h1>Not Found</h1>
<p>
Գիրքը բացակայում է՝ non-existent-book
</p>
)" },
{ /* url */ "/ROOT/suggest?content=no-such-book&term=whatever",
expected_body==R"(
<h1>Not Found</h1>