aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2012-02-18 01:03:43 -0700
committerMcCabe Maxsted2012-02-18 01:06:38 -0700
commitd44056f6d5430e4c8d139ae49783a554c4eee982 (patch)
treed85512a591376edbbc664410ee319883eb7ffee2 /linden/indra/newview/llviewermessage.cpp
parentAdded the new ISS installer template to cmake (diff)
downloadmeta-impy-d44056f6d5430e4c8d139ae49783a554c4eee982.zip
meta-impy-d44056f6d5430e4c8d139ae49783a554c4eee982.tar.gz
meta-impy-d44056f6d5430e4c8d139ae49783a554c4eee982.tar.bz2
meta-impy-d44056f6d5430e4c8d139ae49783a554c4eee982.tar.xz
Removed google translate since the service is no longer available
Diffstat (limited to 'linden/indra/newview/llviewermessage.cpp')
-rwxr-xr-xlinden/indra/newview/llviewermessage.cpp71
1 files changed, 2 insertions, 69 deletions
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index cbcfb86..f0c7c0c 100755
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -139,7 +139,6 @@
139#include "llfloaterworldmap.h" 139#include "llfloaterworldmap.h"
140#include "llviewerdisplay.h" 140#include "llviewerdisplay.h"
141#include "llkeythrottle.h" 141#include "llkeythrottle.h"
142#include "lltranslate.h"
143 142
144#include "panelradarentry.h" 143#include "panelradarentry.h"
145 144
@@ -2805,52 +2804,6 @@ void process_decline_callingcard(LLMessageSystem* msg, void**)
2805 LLNotifications::instance().add("CallingCardDeclined"); 2804 LLNotifications::instance().add("CallingCardDeclined");
2806} 2805}
2807 2806
2808class ChatTranslationReceiver : public LLTranslate::TranslationReceiver
2809{
2810public :
2811 ChatTranslationReceiver(const std::string &fromLang, const std::string &toLang, const LLChat &chat,
2812 const std::string &orig_mesg, const BOOL history)
2813 : LLTranslate::TranslationReceiver(fromLang, toLang),
2814 m_chat(chat),
2815 m_origMesg(orig_mesg),
2816 m_history(history)
2817 {
2818 }
2819
2820 static boost::intrusive_ptr<ChatTranslationReceiver> build(const std::string &fromLang, const std::string &toLang, const LLChat &chat, const std::string &orig_mesg, const BOOL history)
2821 {
2822 return boost::intrusive_ptr<ChatTranslationReceiver>(new ChatTranslationReceiver(fromLang, toLang, chat, orig_mesg, history));
2823 }
2824
2825protected:
2826 void handleResponse(const std::string &translation, const std::string &detected_language)
2827 {
2828 // filter out non-interesting responeses
2829 if ( !translation.empty()
2830 && (m_toLang != detected_language)
2831 && (LLStringUtil::compareInsensitive(translation, m_origMesg) != 0) )
2832 {
2833 m_chat.mText += " (" + translation + ")";
2834 }
2835
2836 add_floater_chat(m_chat, m_history);
2837 }
2838
2839 void handleFailure()
2840 {
2841 LLTranslate::TranslationReceiver::handleFailure();
2842
2843 m_chat.mText += " (?)";
2844
2845 add_floater_chat(m_chat, m_history);
2846 }
2847
2848private:
2849 LLChat m_chat;
2850 std::string m_origMesg;
2851 const BOOL m_history;
2852};
2853
2854void add_floater_chat(const LLChat &chat, const BOOL history) 2807void add_floater_chat(const LLChat &chat, const BOOL history)
2855{ 2808{
2856 if (history) 2809 if (history)
@@ -2865,26 +2818,6 @@ void add_floater_chat(const LLChat &chat, const BOOL history)
2865 } 2818 }
2866} 2819}
2867 2820
2868void check_translate_chat(const std::string &mesg, const LLChat &chat, const BOOL history)
2869{
2870 const bool translate = gSavedSettings.getBOOL("TranslateChat");
2871
2872 if (translate && chat.mSourceType != CHAT_SOURCE_SYSTEM)
2873 {
2874 // fromLang hardcoded to "" (autodetection) pending implementation of
2875 // SVC-4879
2876 const std::string &fromLang = "";
2877 const std::string &toLang = LLTranslate::getTranslateLanguage();
2878
2879 LLHTTPClient::ResponderPtr result = ChatTranslationReceiver::build(fromLang, toLang, chat, mesg, history);
2880 LLTranslate::translateMessage(result, fromLang, toLang, mesg);
2881 }
2882 else
2883 {
2884 add_floater_chat(chat, history);
2885 }
2886}
2887
2888void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) 2821void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2889{ 2822{
2890 LLChat chat; 2823 LLChat chat;
@@ -3304,12 +3237,12 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
3304 && (is_linden || !is_busy || is_owned_by_me)) 3237 && (is_linden || !is_busy || is_owned_by_me))
3305 { 3238 {
3306 // show on screen and add to history 3239 // show on screen and add to history
3307 check_translate_chat(mesg, chat, FALSE); 3240 add_floater_chat(chat, FALSE);
3308 } 3241 }
3309 else 3242 else
3310 { 3243 {
3311 // just add to chat history 3244 // just add to chat history
3312 check_translate_chat(mesg, chat, TRUE); 3245 add_floater_chat(chat, TRUE);
3313 } 3246 }
3314 } 3247 }
3315} 3248}