Internationalized raw-entry-not-found message

This commit is contained in:
Veloman Yunkan 2022-01-23 22:37:29 +04:00 committed by Matthieu Gautier
parent 779382642b
commit d2c864b010
3 changed files with 13 additions and 2 deletions

View File

@ -467,6 +467,16 @@ ParameterizedMessage invalidRawAccessMsg(const std::string& dt)
return ParameterizedMessage("invalid-raw-data-type", { {"DATATYPE", 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) ParameterizedMessage nonParameterizedMessage(const std::string& msgId)
{ {
return ParameterizedMessage(msgId, {}); return ParameterizedMessage(msgId, {});
@ -967,10 +977,9 @@ std::unique_ptr<Response> InternalServer::handle_raw(const RequestContext& reque
if (m_verbose.load()) { if (m_verbose.load()) {
printf("Failed to find %s\n", itemPath.c_str()); printf("Failed to find %s\n", itemPath.c_str());
} }
const std::string error_details = "Cannot find " + kind + " entry " + itemPath;
return HTTP404HtmlResponse(*this, request) return HTTP404HtmlResponse(*this, request)
+ urlNotFoundMsg + urlNotFoundMsg
+ error_details; + rawEntryNotFoundMsg(kind, itemPath);
} }
} }

View File

@ -10,4 +10,5 @@
, "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 :(" , "random-article-failure" : "Oops! Failed to pick a random article :("
, "invalid-raw-data-type" : "{{DATATYPE}} is not a valid request for raw content." , "invalid-raw-data-type" : "{{DATATYPE}} is not a valid request for raw content."
, "raw-entry-not-found" : "Cannot find {{DATATYPE}} entry {{ENTRY}}"
} }

View File

@ -11,4 +11,5 @@
, "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" , "random-article-failure" : "Failure of the random article selection procedure"
, "invalid-raw-data-type" : "Invalid DATATYPE was used with the /raw endpoint (/raw/<book>/DATATYPE/...); allowed values are 'meta' and 'content'" , "invalid-raw-data-type" : "Invalid DATATYPE was used with the /raw endpoint (/raw/<book>/DATATYPE/...); allowed values are 'meta' and 'content'"
, "raw-entry-not-found" : "Entry requested via the /raw endpoint was not found"
} }