From e2552ec6737fe734ffd5b4768193c6a890d66f70 Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine
Date: Tue, 6 Sep 2011 17:45:47 +0300
Subject: STORM-1577 WIP Implemented translation via Microsoft Translator and
Google Translate v2 APIs.
---
indra/newview/app_settings/settings.xml | 33 ++++
indra/newview/lltranslate.cpp | 312 ++++++++++++++++++++++++++------
indra/newview/lltranslate.h | 87 ++-------
indra/newview/llviewermessage.cpp | 7 +-
4 files changed, 316 insertions(+), 123 deletions(-)
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 0996f75fbb..2549538df2 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10922,6 +10922,39 @@
Value
0
+ TranslationService
+
+ GoogleTranslateAPIv2Key
+
+ BingTranslateAPIKey
+
TutorialURL
", begin);
+ err_msg = body.substr(begin, end-begin);
+ LLStringUtil::replaceString(err_msg, "
", ""); // strip CR
+ return false;
+ }
+
+ // Sample response: Hola
+ size_t begin = body.find(">");
+ if (begin == std::string::npos || begin >= (body.size() - 1))
+ {
+ return false;
+ }
+
+ size_t end = body.find("", ++begin);
+ if (end == std::string::npos || end < begin)
+ {
+ return false;
+ }
+
+ detected_lang = ""; // unsupported by this API
+ translation = body.substr(begin, end-begin);
+ LLStringUtil::replaceString(translation, "
", ""); // strip CR
+ return true;
}
- LLHTTPClient::get(url, result, m_Header, m_GoogleTimeout);
+private:
+ static std::string getAPIKey()
+ {
+ return gSavedSettings.getString("BingTranslateAPIKey");
+ }
+};
+
+LLTranslate::TranslationReceiver::TranslationReceiver(const std::string& from_lang, const std::string& to_lang)
+: mFromLang(from_lang)
+, mToLang(to_lang)
+, mHandler(LLTranslate::getPreferredHandler())
+{
}
-//static
-void LLTranslate::getTranslateUrl(std::string &translate_url, const std::string &from_lang, const std::string &to_lang, const std::string &mesg)
+// virtual
+void LLTranslate::TranslationReceiver::completedRaw(
+ U32 http_status,
+ const std::string& reason,
+ const LLChannelDescriptors& channels,
+ const LLIOPipe::buffer_ptr_t& buffer)
{
- char * curl_str = curl_escape(mesg.c_str(), mesg.size());
- std::string const escaped_mesg(curl_str);
- curl_free(curl_str);
-
- translate_url = m_GoogleURL
- + escaped_mesg + m_GoogleLangSpec
- + from_lang // 'from' language; empty string for auto
- + "%7C" // |
- + to_lang; // 'to' language
+ LLBufferStream istr(channels, buffer.get());
+ std::stringstream strstrm;
+ strstrm << istr.rdbuf();
+
+ const std::string body = strstrm.str();
+ std::string translation, detected_lang, err_msg;
+ int status = http_status;
+ if (mHandler.parseResponse(status, body, translation, detected_lang, err_msg))
+ {
+ // Fix up the response
+ LLStringUtil::replaceString(translation, "<", "<");
+ LLStringUtil::replaceString(translation, ">",">");
+ LLStringUtil::replaceString(translation, ""","\"");
+ LLStringUtil::replaceString(translation, "'","'");
+ LLStringUtil::replaceString(translation, "&","&");
+ LLStringUtil::replaceString(translation, "'","'");
+
+ handleResponse(translation, detected_lang);
+ }
+ else
+ {
+ llwarns << "Translation request failed: " << err_msg << llendl;
+ LL_DEBUGS("Translate") << "HTTP status: " << status << " " << reason << LL_ENDL;
+ LL_DEBUGS("Translate") << "Error response body: " << body << LL_ENDL;
+ handleFailure(status, err_msg);
+ }
}
//static
-bool LLTranslate::parseGoogleTranslate(const std::string& body, std::string &translation, std::string &detected_language)
+void LLTranslate::translateMessage(
+ TranslationReceiverPtr &receiver,
+ const std::string &from_lang,
+ const std::string &to_lang,
+ const std::string &mesg)
{
- Json::Value root;
- Json::Reader reader;
-
- bool success = reader.parse(body, root);
- if (!success)
+ std::string url;
+ receiver->mHandler.getTranslateURL(url, from_lang, to_lang, mesg);
+
+ static const float REQUEST_TIMEOUT = 5;
+ static LLSD sHeader;
+
+ if (!sHeader.size())
{
- LL_WARNS("Translate") << "Non valid response from Google Translate API: '" << reader.getFormatedErrorMessages() << "'" << LL_ENDL;
- return false;
+ std::string user_agent = llformat("%s %d.%d.%d (%d)",
+ LLVersionInfo::getChannel().c_str(),
+ LLVersionInfo::getMajor(),
+ LLVersionInfo::getMinor(),
+ LLVersionInfo::getPatch(),
+ LLVersionInfo::getBuild());
+
+ sHeader.insert("Accept", "text/plain");
+ sHeader.insert("User-Agent", user_agent);
}
-
- translation = root[m_GoogleData].get(m_GoogleTranslation, "").asString();
- detected_language = root[m_GoogleData].get(m_GoogleLanguage, "").asString();
- return true;
+
+ LL_DEBUGS("Translate") << "Sending translation request: " << url << LL_ENDL;
+ LLHTTPClient::get(url, receiver, sHeader, REQUEST_TIMEOUT);
}
//static
@@ -119,3 +308,22 @@ std::string LLTranslate::getTranslateLanguage()
return language;
}
+// static
+const LLTranslationAPIHandler& LLTranslate::getPreferredHandler()
+{
+ static LLGoogleV1Handler google_v1;
+ static LLGoogleV2Handler google_v2;
+ static LLBingHandler bing;
+
+ std::string service = gSavedSettings.getString("TranslationService");
+ if (service == "google_v2")
+ {
+ return google_v2;
+ }
+ else if (service == "google_v1")
+ {
+ return google_v1;
+ }
+
+ return bing;
+}
diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h
index e85a42e878..1dee792f7b 100644
--- a/indra/newview/lltranslate.h
+++ b/indra/newview/lltranslate.h
@@ -30,89 +30,42 @@
#include "llhttpclient.h"
#include "llbufferstream.h"
+class LLTranslationAPIHandler;
+
class LLTranslate
{
LOG_CLASS(LLTranslate);
+
public :
class TranslationReceiver: public LLHTTPClient::Responder
{
- protected:
- TranslationReceiver(const std::string &from_lang, const std::string &to_lang)
- : m_fromLang(from_lang),
- m_toLang(to_lang)
- {
- }
-
- virtual void handleResponse(const std::string &translation, const std::string &recognized_lang) {};
- virtual void handleFailure() {};
-
public:
- ~TranslationReceiver()
- {
- }
-
- virtual void completedRaw( U32 status,
- const std::string& reason,
- const LLChannelDescriptors& channels,
- const LLIOPipe::buffer_ptr_t& buffer)
- {
- if (200 <= status && status < 300)
- {
- LLBufferStream istr(channels, buffer.get());
- std::stringstream strstrm;
- strstrm << istr.rdbuf();
+ /*virtual*/ void completedRaw(
+ U32 http_status,
+ const std::string& reason,
+ const LLChannelDescriptors& channels,
+ const LLIOPipe::buffer_ptr_t& buffer);
- const std::string result = strstrm.str();
- std::string translation;
- std::string detected_language;
+ protected:
+ friend class LLTranslate;
- if (!parseGoogleTranslate(result, translation, detected_language))
- {
- handleFailure();
- return;
- }
-
- // Fix up the response
- LLStringUtil::replaceString(translation, "<", "<");
- LLStringUtil::replaceString(translation, ">",">");
- LLStringUtil::replaceString(translation, ""","\"");
- LLStringUtil::replaceString(translation, "'","'");
- LLStringUtil::replaceString(translation, "&","&");
- LLStringUtil::replaceString(translation, "'","'");
+ TranslationReceiver(const std::string& from_lang, const std::string& to_lang);
- handleResponse(translation, detected_language);
- }
- else
- {
- LL_WARNS("Translate") << "HTTP request for Google Translate failed with status " << status << ", reason: " << reason << LL_ENDL;
- handleFailure();
- }
- }
+ virtual void handleResponse(const std::string &translation, const std::string &recognized_lang) = 0;
+ virtual void handleFailure(int status, const std::string& err_msg) = 0;
- protected:
- const std::string m_toLang;
- const std::string m_fromLang;
+ std::string mFromLang;
+ std::string mToLang;
+ const LLTranslationAPIHandler& mHandler;
};
- static void translateMessage(LLHTTPClient::ResponderPtr &result, const std::string &from_lang, const std::string &to_lang, const std::string &mesg);
- static float m_GoogleTimeout;
+ typedef boost::intrusive_ptr TranslationReceiverPtr;
+
+ static void translateMessage(TranslationReceiverPtr &receiver, const std::string &from_lang, const std::string &to_lang, const std::string &mesg);
static std::string getTranslateLanguage();
private:
- static void getTranslateUrl(std::string &translate_url, const std::string &from_lang, const std::string &to_lang, const std::string &text);
- static bool parseGoogleTranslate(const std::string& body, std::string &translation, std::string &detected_language);
-
- static LLSD m_Header;
- static const char* m_GoogleURL;
- static const char* m_GoogleLangSpec;
- static const char* m_AcceptHeader;
- static const char* m_AcceptType;
- static const char* m_AgentHeader;
- static const char* m_UserAgent;
-
- static const char* m_GoogleData;
- static const char* m_GoogleTranslation;
- static const char* m_GoogleLanguage;
+ static const LLTranslationAPIHandler& getPreferredHandler();
};
#endif
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 68745d5aeb..ff02214194 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -3138,7 +3138,7 @@ protected:
{
// filter out non-interesting responeses
if ( !translation.empty()
- && (m_toLang != detected_language)
+ && (mToLang != detected_language)
&& (LLStringUtil::compareInsensitive(translation, m_origMesg) != 0) )
{
m_chat.mText += " (" + translation + ")";
@@ -3147,9 +3147,8 @@ protected:
LLNotificationsUI::LLNotificationManager::instance().onChat(m_chat, m_toastArgs);
}
- void handleFailure()
+ void handleFailure(int status, const std::string& err_msg)
{
- LLTranslate::TranslationReceiver::handleFailure();
m_chat.mText += " (?)";
LLNotificationsUI::LLNotificationManager::instance().onChat(m_chat, m_toastArgs);
@@ -3388,7 +3387,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
const std::string from_lang = ""; // leave empty to trigger autodetect
const std::string to_lang = LLTranslate::getTranslateLanguage();
- LLHTTPClient::ResponderPtr result = ChatTranslationReceiver::build(from_lang, to_lang, mesg, chat, args);
+ LLTranslate::TranslationReceiverPtr result = ChatTranslationReceiver::build(from_lang, to_lang, mesg, chat, args);
LLTranslate::translateMessage(result, from_lang, to_lang, mesg);
}
else
--
cgit v1.2.3
From e23ecf311c729be7e6611ef2fe21badaf9f1c3ed Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine
Date: Wed, 7 Sep 2011 00:09:49 +0300
Subject: STORM-1577 WIP Implemented chat translation preferences management.
---
indra/newview/CMakeLists.txt | 2 +
indra/newview/llfloaterpreference.cpp | 9 +
indra/newview/llfloaterpreference.h | 1 +
indra/newview/llfloatertranslationsettings.cpp | 146 ++++++++++++++
indra/newview/llfloatertranslationsettings.h | 59 ++++++
indra/newview/llviewerfloaterreg.cpp | 2 +
.../xui/en/floater_translation_settings.xml | 222 +++++++++++++++++++++
.../default/xui/en/panel_preferences_chat.xml | 12 ++
8 files changed, 453 insertions(+)
create mode 100644 indra/newview/llfloatertranslationsettings.cpp
create mode 100644 indra/newview/llfloatertranslationsettings.h
create mode 100644 indra/newview/skins/default/xui/en/floater_translation_settings.xml
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index a117d9a593..e7ca2a4294 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -237,6 +237,7 @@ set(viewer_SOURCE_FILES
llfloatertools.cpp
llfloatertopobjects.cpp
llfloatertos.cpp
+ llfloatertranslationsettings.cpp
llfloateruipreview.cpp
llfloaterurlentry.cpp
llfloatervoiceeffect.cpp
@@ -799,6 +800,7 @@ set(viewer_HEADER_FILES
llfloatertools.h
llfloatertopobjects.h
llfloatertos.h
+ llfloatertranslationsettings.h
llfloateruipreview.h
llfloaterurlentry.h
llfloatervoiceeffect.h
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index d65928e385..07c07d608a 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -345,6 +345,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this));
mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this));
mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this));
+ mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this));
sSkin = gSavedSettings.getString("SkinCurrent");
@@ -602,6 +603,9 @@ void LLFloaterPreference::cancel()
}
// hide joystick pref floater
LLFloaterReg::hideInstance("pref_joystick");
+
+ // hide translation settings floater
+ LLFloaterReg::hideInstance("prefs_translation");
// cancel hardware menu
LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance("prefs_hardware_settings");
@@ -1553,6 +1557,11 @@ void LLFloaterPreference::onClickProxySettings()
LLFloaterReg::showInstance("prefs_proxy");
}
+void LLFloaterPreference::onClickTranslationSettings()
+{
+ LLFloaterReg::showInstance("prefs_translation");
+}
+
void LLFloaterPreference::updateDoubleClickControls()
{
// check is one of double-click actions settings enabled
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index ef9bc2dd53..ee6bb235be 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -157,6 +157,7 @@ public:
void onChangeMaturity();
void onClickBlockList();
void onClickProxySettings();
+ void onClickTranslationSettings();
void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
void getUIColor(LLUICtrl* ctrl, const LLSD& param);
diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp
new file mode 100644
index 0000000000..56f101d149
--- /dev/null
+++ b/indra/newview/llfloatertranslationsettings.cpp
@@ -0,0 +1,146 @@
+/**
+ * @file llfloatertranslationsettings.cpp
+ * @brief Machine translation settings for chat
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloatertranslationsettings.h"
+
+// Viewer includes
+#include "llviewercontrol.h" // for gSavedSettings
+
+// Linden library includes
+#include "llbutton.h"
+#include "llcheckboxctrl.h"
+#include "llcombobox.h"
+#include "llfloaterreg.h"
+#include "lllineeditor.h"
+#include "llnotificationsutil.h"
+#include "llradiogroup.h"
+
+LLFloaterTranslationSettings::LLFloaterTranslationSettings(const LLSD& key)
+: LLFloater(key)
+, mMachineTranslationCB(NULL)
+, mLanguageCombo(NULL)
+, mTranslationServiceRadioGroup(NULL)
+, mBingAPIKeyEditor(NULL)
+, mGoogleAPIKeyEditor(NULL)
+{
+}
+
+// virtual
+BOOL LLFloaterTranslationSettings::postBuild()
+{
+ mMachineTranslationCB = getChild("translate_chat_checkbox");
+ mLanguageCombo = getChild("translate_language_combo");
+ mTranslationServiceRadioGroup = getChild("translation_service_rg");
+ mBingAPIKeyEditor = getChild("bing_api_key");
+ mGoogleAPIKeyEditor = getChild("google_api_key");
+
+ mMachineTranslationCB->setCommitCallback(boost::bind(&LLFloaterTranslationSettings::updateControlsEnabledState, this));
+ mTranslationServiceRadioGroup->setCommitCallback(boost::bind(&LLFloaterTranslationSettings::updateControlsEnabledState, this));
+ getChild("ok_btn")->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnOK, this));
+ getChild("cancel_btn")->setClickedCallback(boost::bind(&LLFloater::closeFloater, this, false));
+
+ center();
+ return TRUE;
+}
+
+// virtual
+void LLFloaterTranslationSettings::onOpen(const LLSD& key)
+{
+ mMachineTranslationCB->setValue(gSavedSettings.getBOOL("TranslateChat"));
+ mLanguageCombo->setSelectedByValue(gSavedSettings.getString("TranslateLanguage"), TRUE);
+ mTranslationServiceRadioGroup->setSelectedByValue(gSavedSettings.getString("TranslationService"), TRUE);
+ mBingAPIKeyEditor->setText(gSavedSettings.getString("BingTranslateAPIKey"));
+ mGoogleAPIKeyEditor->setText(gSavedSettings.getString("GoogleTranslateAPIv2Key"));
+
+ updateControlsEnabledState();
+}
+
+std::string LLFloaterTranslationSettings::getSelectedService() const
+{
+ return mTranslationServiceRadioGroup->getSelectedValue().asString();
+}
+
+void LLFloaterTranslationSettings::showError(const std::string& err_name)
+{
+ LLSD args;
+ args["MESSAGE"] = getString(err_name);
+ LLNotificationsUtil::add("GenericAlert", args);
+}
+
+bool LLFloaterTranslationSettings::validate()
+{
+ bool translate_chat = mMachineTranslationCB->getValue().asBoolean();
+ if (!translate_chat) return true;
+
+ std::string service = getSelectedService();
+ if (service == "bing" && mBingAPIKeyEditor->getText().empty())
+ {
+ showError("no_bing_api_key");
+ return false;
+ }
+
+ if (service == "google_v2" && mGoogleAPIKeyEditor->getText().empty())
+ {
+ showError("no_google_api_key");
+ return false;
+ }
+
+ return true;
+}
+
+void LLFloaterTranslationSettings::updateControlsEnabledState()
+{
+ // Enable/disable controls based on the checkbox value.
+ bool on = mMachineTranslationCB->getValue().asBoolean();
+ std::string service = getSelectedService();
+
+ mTranslationServiceRadioGroup->setEnabled(on);
+ mLanguageCombo->setEnabled(on);
+
+ getChild("bing_api_key_label")->setEnabled(on);
+ mBingAPIKeyEditor->setEnabled(on);
+
+ getChild("google_api_key_label")->setEnabled(on);
+ mGoogleAPIKeyEditor->setEnabled(on);
+
+ mBingAPIKeyEditor->setEnabled(service == "bing");
+ mGoogleAPIKeyEditor->setEnabled(service == "google_v2");
+}
+
+void LLFloaterTranslationSettings::onBtnOK()
+{
+ if (validate())
+ {
+ gSavedSettings.setBOOL("TranslateChat", mMachineTranslationCB->getValue().asBoolean());
+ gSavedSettings.setString("TranslateLanguage", mLanguageCombo->getSelectedValue().asString());
+ gSavedSettings.setString("TranslationService", getSelectedService());
+ gSavedSettings.setString("BingTranslateAPIKey", mBingAPIKeyEditor->getText());
+ gSavedSettings.setString("GoogleTranslateAPIv2Key", mGoogleAPIKeyEditor->getText());
+ closeFloater(false);
+ }
+}
diff --git a/indra/newview/llfloatertranslationsettings.h b/indra/newview/llfloatertranslationsettings.h
new file mode 100644
index 0000000000..1c03b86f4d
--- /dev/null
+++ b/indra/newview/llfloatertranslationsettings.h
@@ -0,0 +1,59 @@
+/**
+ * @file llfloatertranslationsettings.h
+ * @brief Machine translation settings for chat
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATERTRANSLATIONSETTINGS_H
+#define LL_LLFLOATERTRANSLATIONSETTINGS_H
+
+#include "llfloater.h"
+
+class LLCheckBoxCtrl;
+class LLComboBox;
+class LLLineEditor;
+class LLRadioGroup;
+
+class LLFloaterTranslationSettings : public LLFloater
+{
+public:
+ LLFloaterTranslationSettings(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+private:
+ std::string getSelectedService() const;
+ void showError(const std::string& err_name);
+ bool validate();
+ void updateControlsEnabledState();
+ void onMachineTranslationToggle();
+ void onBtnOK();
+
+ LLCheckBoxCtrl* mMachineTranslationCB;
+ LLComboBox* mLanguageCombo;
+ LLLineEditor* mBingAPIKeyEditor;
+ LLLineEditor* mGoogleAPIKeyEditor;
+ LLRadioGroup* mTranslationServiceRadioGroup;
+};
+
+#endif // LL_LLFLOATERTRANSLATIONSETTINGS_H
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index fecc6d91bd..3be26d87e2 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -102,6 +102,7 @@
#include "llfloatertools.h"
#include "llfloatertos.h"
#include "llfloatertopobjects.h"
+#include "llfloatertranslationsettings.h"
#include "llfloateruipreview.h"
#include "llfloatervoiceeffect.h"
#include "llfloaterwhitelistentry.h"
@@ -234,6 +235,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build);
LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build);
LLFloaterReg::add("prefs_hardware_settings", "floater_hardware_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build);
+ LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build);
LLFloaterReg::add("perm_prefs", "floater_perm_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build);
LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build);
LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview");
diff --git a/indra/newview/skins/default/xui/en/floater_translation_settings.xml b/indra/newview/skins/default/xui/en/floater_translation_settings.xml
new file mode 100644
index 0000000000..40a176830c
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml
@@ -0,0 +1,222 @@
+
+
+
+ Bing Translator requires and appID to function.
+ Google Translate requires an API key to function.
+
+
+
+ Translate chat into:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Choose translation service to use:
+
+
+
+
+
+
+
+
+ Bing [http://www.bing.com/developers/createapp.aspx AppID]:
+
+
+
+
+ Google [http://code.google.com/apis/language/translate/v2/pricing.html API key]:
+
+
+
+
+ ([http://code.google.com/apis/language/translate/v2/pricing.html pricing])
+
+
+
+
+
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
index ea09286592..3fbf484ab2 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
@@ -319,4 +319,16 @@
name="Korean"
value="ko" />
+
\ No newline at end of file
--
cgit v1.2.3
From 7975ab138b6ac54fc831613e4d3dfb913c5efbd2 Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine
Date: Wed, 7 Sep 2011 16:14:47 +0300
Subject: STORM-1577 Removed support for Google Translate v1 API.
---
indra/newview/app_settings/settings.xml | 10 ++--
indra/newview/llfloatertranslationsettings.cpp | 8 +--
indra/newview/lltranslate.cpp | 67 +++-------------------
.../xui/en/floater_translation_settings.xml | 4 +-
4 files changed, 18 insertions(+), 71 deletions(-)
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 2549538df2..2f1a2093b2 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10925,18 +10925,18 @@
TranslationService
- GoogleTranslateAPIv2Key
+ GoogleTranslateAPIKey