From d2c864b0109bb1a7fae16446b926daa2e852cbd5 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sun, 23 Jan 2022 22:37:29 +0400 Subject: [PATCH] Internationalized raw-entry-not-found message --- src/server/internalServer.cpp | 13 +++++++++++-- static/i18n/en.json | 1 + static/i18n/qqq.json | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index f13b9e23a..7ee986935 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -467,6 +467,16 @@ ParameterizedMessage invalidRawAccessMsg(const std::string& dt) return ParameterizedMessage("invalid-raw-data-type", { {"DATATYPE", dt} }); } +ParameterizedMessage rawEntryNotFoundMsg(const std::string& dt, const std::string& entry) +{ + return ParameterizedMessage("raw-entry-not-found", + { + {"DATATYPE", dt}, + {"ENTRY", entry}, + } + ); +} + ParameterizedMessage nonParameterizedMessage(const std::string& msgId) { return ParameterizedMessage(msgId, {}); @@ -967,10 +977,9 @@ std::unique_ptr InternalServer::handle_raw(const RequestContext& reque if (m_verbose.load()) { printf("Failed to find %s\n", itemPath.c_str()); } - const std::string error_details = "Cannot find " + kind + " entry " + itemPath; return HTTP404HtmlResponse(*this, request) + urlNotFoundMsg - + error_details; + + rawEntryNotFoundMsg(kind, itemPath); } } diff --git a/static/i18n/en.json b/static/i18n/en.json index 4772302fe..415d7fbd5 100644 --- a/static/i18n/en.json +++ b/static/i18n/en.json @@ -10,4 +10,5 @@ , "suggest-search" : "Make a full text search for {{PATTERN}}" , "random-article-failure" : "Oops! Failed to pick a random article :(" , "invalid-raw-data-type" : "{{DATATYPE}} is not a valid request for raw content." + , "raw-entry-not-found" : "Cannot find {{DATATYPE}} entry {{ENTRY}}" } diff --git a/static/i18n/qqq.json b/static/i18n/qqq.json index 34f57dd01..0ade75a60 100644 --- a/static/i18n/qqq.json +++ b/static/i18n/qqq.json @@ -11,4 +11,5 @@ , "suggest-search" : "Suggest a search when the URL points to a non existing article" , "random-article-failure" : "Failure of the random article selection procedure" , "invalid-raw-data-type" : "Invalid DATATYPE was used with the /raw endpoint (/raw//DATATYPE/...); allowed values are 'meta' and 'content'" + , "raw-entry-not-found" : "Entry requested via the /raw endpoint was not found" }