summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/lltranslate.cpp21
-rw-r--r--indra/newview/skins/default/xui/en/floater_translation_settings.xml2
2 files changed, 19 insertions, 4 deletions
diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp
index 70a40921ef..c37c955e8d 100644
--- a/indra/newview/lltranslate.cpp
+++ b/indra/newview/lltranslate.cpp
@@ -949,6 +949,8 @@ bool LLDeepLTranslationHandler::checkVerificationResponse(
const LLSD& response,
int status) const
{
+ // Might need to parse body to make sure we got
+ // a valid response and not a message
return status == HTTP_OK;
}
@@ -1000,7 +1002,6 @@ bool LLDeepLTranslationHandler::parseResponse(
{
return false;
}
-
detected_lang = data["detected_source_language"].asString();
LLStringUtil::toLower(detected_lang);
@@ -1019,8 +1020,22 @@ bool LLDeepLTranslationHandler::isConfigured() const
std::string LLDeepLTranslationHandler::parseErrorResponse(
const std::string& body)
{
- // DeepL doesn't seem to have any error handling beyoun http codes
- return std::string();
+ // Example: "{\"message\":\"One of the request inputs is not valid.\"}"
+
+ Json::Value root;
+ Json::Reader reader;
+
+ if (!reader.parse(body, root))
+ {
+ return std::string();
+ }
+
+ if (!root.isObject() || !root.isMember("message"))
+ {
+ return std::string();
+ }
+
+ return root["message"].asString();
}
// static
diff --git a/indra/newview/skins/default/xui/en/floater_translation_settings.xml b/indra/newview/skins/default/xui/en/floater_translation_settings.xml
index 8a97d5e5d9..3f3331b468 100644
--- a/indra/newview/skins/default/xui/en/floater_translation_settings.xml
+++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml
@@ -319,7 +319,7 @@
name="deepl_api_domain_label"
top_pad="80"
width="85">
- Domain:
+ Endpoint:
</text>
<combo_box