diff options
author | Rider Linden <rider@lindenlab.com> | 2015-11-02 12:34:59 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2015-11-02 12:34:59 -0800 |
commit | 8866ba3a7f6c463fe9bf56630a6677206824e603 (patch) | |
tree | 8e4560d513cb8ac25bbd90eaf81968e6a9bd28cf | |
parent | d4576e987f235e3e96516db1f342cbcf7e4c36e9 (diff) |
MAINT-5812: Correctly pull a string from the raw body. Only compare languages if detected_language is blank.
-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 + ")"; |