diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index be831d5df..60d8b0741 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -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() diff --git a/static/i18n/en.json b/static/i18n/en.json index 4b87abe0a..d6b197e76 100644 --- a/static/i18n/en.json +++ b/static/i18n/en.json @@ -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." } diff --git a/static/i18n/hy.json b/static/i18n/hy.json index 376236325..9b55d8c38 100644 --- a/static/i18n/hy.json +++ b/static/i18n/hy.json @@ -5,5 +5,6 @@ }, "name":"Հայերեն", "suggest-full-text-search": "որոնել '{{{SEARCH_TERMS}}}'..." + , "no-such-book": "Գիրքը բացակայում է՝ {{BOOK_NAME}}" , "url-not-found" : "Սխալ հասցե՝ {{url}}" } diff --git a/static/i18n/qqq.json b/static/i18n/qqq.json index f62e435e1..a0a3fbb1e 100644 --- a/static/i18n/qqq.json +++ b/static/i18n/qqq.json @@ -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" } diff --git a/test/server.cpp b/test/server.cpp index 7508a7bf2..f89e2236a 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -571,6 +571,14 @@ TEST_F(ServerTest, 404WithBodyTesting)
)" }, + { /* url */ "/ROOT/random?content=non-existent-book&userlang=hy", + expected_body==R"( ++ Գիրքը բացակայում է՝ non-existent-book +
+)" }, + { /* url */ "/ROOT/suggest?content=no-such-book&term=whatever", expected_body==R"(