Revert "This works for now. Need to do more testing."

This reverts commit c6d6eed7d3.
This commit is contained in:
Drake Arconis
2012-02-21 09:27:10 -05:00
parent ad1e3f1d2d
commit 6388324552
4 changed files with 221 additions and 692 deletions

View File

@@ -2957,23 +2957,23 @@ void process_decline_callingcard(LLMessageSystem* msg, void**)
class ChatTranslationReceiver : public LLTranslate::TranslationReceiver
{
public :
ChatTranslationReceiver(const std::string &from_lang, const std::string &to_lang, LLChat *chat,
ChatTranslationReceiver(const std::string &fromLang, const std::string &toLang, LLChat *chat,
const BOOL history)
: LLTranslate::TranslationReceiver(from_lang, to_lang),
: LLTranslate::TranslationReceiver(fromLang, toLang),
m_chat(chat),
m_history(history)
{
}
static boost::intrusive_ptr<ChatTranslationReceiver> build(const std::string &from_lang, const std::string &to_lang, LLChat *chat, const BOOL history)
static boost::intrusive_ptr<ChatTranslationReceiver> build(const std::string &fromLang, const std::string &toLang, LLChat *chat, const BOOL history)
{
return boost::intrusive_ptr<ChatTranslationReceiver>(new ChatTranslationReceiver(from_lang, to_lang, chat, history));
return boost::intrusive_ptr<ChatTranslationReceiver>(new ChatTranslationReceiver(fromLang, toLang, chat, history));
}
protected:
void handleResponse(const std::string &translation, const std::string &detectedLanguage)
{
if (mToLang != detectedLanguage)
if (m_toLang != detectedLanguage)
m_chat->mText += " (" + translation + ")";
add_floater_chat(*m_chat, m_history);
@@ -2981,12 +2981,14 @@ protected:
delete m_chat;
}
void handleFailure(int status, const std::string& err_msg)
void handleFailure()
{
llwarns << "Translation failed for mesg " << m_chat << " toLang " << mToLang << " fromLang " << mFromLang << llendl;
LLTranslate::TranslationReceiver::handleFailure();
m_chat->mText += " (?)";
add_floater_chat(*m_chat, m_history);
delete m_chat;
}
@@ -3015,12 +3017,14 @@ void check_translate_chat(const std::string &mesg, LLChat &chat, const BOOL hist
if (translate && chat.mSourceType != CHAT_SOURCE_SYSTEM)
{
const std::string &from_lang = "";
const std::string &to_lang = LLTranslate::getTranslateLanguage();
// fromLang hardcoded to "" (autodetection) pending implementation of
// SVC-4879
const std::string &fromLang = "";
const std::string &toLang = LLTranslate::getTranslateLanguage();
LLChat *newChat = new LLChat(chat);
LLTranslate::TranslationReceiverPtr result = ChatTranslationReceiver::build(from_lang, to_lang, newChat, history);
LLTranslate::translateMessage(result, from_lang, to_lang, mesg);
LLHTTPClient::ResponderPtr result = ChatTranslationReceiver::build(fromLang, toLang, newChat, history);
LLTranslate::translateMessage(result, fromLang, toLang, mesg);
}
else
{