diff options
-rwxr-xr-x | indra/newview/lltranslate.cpp | 9 | ||||
-rwxr-xr-x | indra/newview/llviewermessage.cpp | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 76fba82ef6..e2108d67a8 100755 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -192,11 +192,14 @@ void LLTranslationAPIHandler::translateMessageCoro(LanguagePair_t fromTo, std::s LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - std::string translation, detected_lang, err_msg; + std::string translation, err_msg; + std::string detected_lang(fromTo.second); int parseResult = status.getType(); - if (this->parseResponse(parseResult, result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asString(), - translation, detected_lang, err_msg)) + const LLSD::Binary &rawBody = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); + std::string body(rawBody.cbegin(), rawBody.cend()); + + if (this->parseResponse(parseResult, body, translation, detected_lang, err_msg)) { // Fix up the response LLStringUtil::replaceString(translation, "<", "<"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7000dcf21b..d995ce4cdf 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3496,7 +3496,7 @@ void translateSuccess(LLChat chat, LLSD toastArgs, std::string originalMsg, std: { // filter out non-interesting responses if (!translation.empty() - && (expectLang != detected_language) + && ((detected_language.empty()) || (expectLang != detected_language)) && (LLStringUtil::compareInsensitive(translation, originalMsg) != 0)) { chat.mText += " (" + translation + ")"; |