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(-) (limited to 'indra') 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 + + Comment + Translation API to use. (google_v1|google_v2|bing) + Persist + 1 + Type + String + Value + google_v1 + + GoogleTranslateAPIv2Key + + Comment + Google Translate API v2 key + Persist + 1 + Type + String + Value + + + BingTranslateAPIKey + + Comment + Bing AppID to use with the Microsoft Translator V2 API + Persist + 1 + Type + String + Value + + TutorialURL Comment diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 2f60b6b90b..e29ea373ce 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -37,74 +37,263 @@ #include "reader.h" -// These two are concatenated with the language specifiers to form a complete Google Translate URL -const char* LLTranslate::m_GoogleURL = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q="; -const char* LLTranslate::m_GoogleLangSpec = "&langpair="; -float LLTranslate::m_GoogleTimeout = 5; - -LLSD LLTranslate::m_Header; -// These constants are for the GET header. -const char* LLTranslate::m_AcceptHeader = "Accept"; -const char* LLTranslate::m_AcceptType = "text/plain"; -const char* LLTranslate::m_AgentHeader = "User-Agent"; - -// These constants are in the JSON returned from Google -const char* LLTranslate::m_GoogleData = "responseData"; -const char* LLTranslate::m_GoogleTranslation = "translatedText"; -const char* LLTranslate::m_GoogleLanguage = "detectedSourceLanguage"; +class LLTranslationAPIHandler +{ +public: + virtual void getTranslateURL( + std::string &url, + const std::string &from_lang, + const std::string &to_lang, + const std::string &text) const = 0; -//static -void LLTranslate::translateMessage(LLHTTPClient::ResponderPtr &result, const std::string &from_lang, const std::string &to_lang, const std::string &mesg) + virtual bool parseResponse( + int& status, + const std::string& body, + std::string& translation, + std::string& detected_lang, + std::string& err_msg) const = 0; + + virtual ~LLTranslationAPIHandler() {} + +protected: + static const int STATUS_OK = 200; +}; + +class LLGoogleV1Handler : public LLTranslationAPIHandler { - std::string url; - getTranslateUrl(url, from_lang, to_lang, mesg); + LOG_CLASS(LLGoogleV1Handler); + +public: + /*virtual*/ void getTranslateURL( + std::string &url, + const std::string &from_lang, + const std::string &to_lang, + const std::string &text) const + { + url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" + + LLURI::escape(text) + + "&langpair=" + from_lang + "%7C" + to_lang; + } + + /*virtual*/ bool parseResponse( + int& status, + const std::string& body, + std::string& translation, + std::string& detected_lang, + std::string& err_msg) const + { + Json::Value root; + Json::Reader reader; + + if (!reader.parse(body, root)) + { + err_msg = reader.getFormatedErrorMessages(); + return false; + } + + // This API doesn't return proper status in the HTTP response header, + // but it is in the body. + status = root["responseStatus"].asInt(); + if (status != STATUS_OK) + { + err_msg = root["responseDetails"].asString(); + return false; + } + + const Json::Value& response_data = root["responseData"]; + translation = response_data.get("translatedText", "").asString(); + detected_lang = response_data.get("detectedSourceLanguage", "").asString(); + return true; + } +}; + +class LLGoogleV2Handler : public LLTranslationAPIHandler +{ + LOG_CLASS(LLGoogleV2Handler); + +public: + /*virtual*/ void getTranslateURL( + std::string &url, + const std::string &from_lang, + const std::string &to_lang, + const std::string &text) const + { + url = std::string("https://www.googleapis.com/language/translate/v2?key=") + + getAPIKey() + "&q=" + LLURI::escape(text) + "&target=" + to_lang; + if (!from_lang.empty()) + { + url += "&source=" + from_lang; + } + } + + /*virtual*/ bool parseResponse( + int& status, + const std::string& body, + std::string& translation, + std::string& detected_lang, + std::string& err_msg) const + { + Json::Value root; + Json::Reader reader; + + if (!reader.parse(body, root)) + { + err_msg = reader.getFormatedErrorMessages(); + return false; + } + + if (status != STATUS_OK) + { + const Json::Value& error = root["error"]; + err_msg = error["message"].asString(); + status = error["code"].asInt(); + return false; + } + + const Json::Value& response_data = root["data"]["translations"][0U]; + translation = response_data["translatedText"].asString(); + detected_lang = response_data["detectedSourceLanguage"].asString(); + return true; + } + +private: + static std::string getAPIKey() + { + return gSavedSettings.getString("GoogleTranslateAPIv2Key"); + } +}; + +class LLBingHandler : public LLTranslationAPIHandler +{ + LOG_CLASS(LLBingHandler); - std::string user_agent = llformat("%s %d.%d.%d (%d)", - LLVersionInfo::getChannel().c_str(), - LLVersionInfo::getMajor(), - LLVersionInfo::getMinor(), - LLVersionInfo::getPatch(), - LLVersionInfo::getBuild()); +public: + /*virtual*/ void getTranslateURL( + std::string &url, + const std::string &from_lang, + const std::string &to_lang, + const std::string &text) const + { + url = std::string("http://api.microsofttranslator.com/v2/Http.svc/Translate?appId=") + + getAPIKey() + "&text=" + LLURI::escape(text) + "&to=" + to_lang; + if (!from_lang.empty()) + { + url += "&from=" + from_lang; + } + } - if (!m_Header.size()) + /*virtual*/ bool parseResponse( + int& status, + const std::string& body, + std::string& translation, + std::string& detected_lang, + std::string& err_msg) const { - m_Header.insert(m_AcceptHeader, LLSD(m_AcceptType)); - m_Header.insert(m_AgentHeader, LLSD(user_agent)); + if (status != STATUS_OK) + { + size_t begin = body.find("Message: "); + size_t end = body.find("

", 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 (limited to 'indra') 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]) + + + \ 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(-) (limited to 'indra') 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 Comment - Translation API to use. (google_v1|google_v2|bing) + Translation API to use. (google|bing) Persist 1 Type String Value - google_v1 + bing - GoogleTranslateAPIv2Key + GoogleTranslateAPIKey Comment - Google Translate API v2 key + Google Translate API key Persist 1 Type @@ -10947,7 +10947,7 @@ BingTranslateAPIKey Comment - Bing AppID to use with the Microsoft Translator V2 API + Bing AppID to use with the Microsoft Translator API Persist 1 Type diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp index 56f101d149..107205aed3 100644 --- a/indra/newview/llfloatertranslationsettings.cpp +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -75,7 +75,7 @@ void LLFloaterTranslationSettings::onOpen(const LLSD& key) mLanguageCombo->setSelectedByValue(gSavedSettings.getString("TranslateLanguage"), TRUE); mTranslationServiceRadioGroup->setSelectedByValue(gSavedSettings.getString("TranslationService"), TRUE); mBingAPIKeyEditor->setText(gSavedSettings.getString("BingTranslateAPIKey")); - mGoogleAPIKeyEditor->setText(gSavedSettings.getString("GoogleTranslateAPIv2Key")); + mGoogleAPIKeyEditor->setText(gSavedSettings.getString("GoogleTranslateAPIKey")); updateControlsEnabledState(); } @@ -104,7 +104,7 @@ bool LLFloaterTranslationSettings::validate() return false; } - if (service == "google_v2" && mGoogleAPIKeyEditor->getText().empty()) + if (service == "google" && mGoogleAPIKeyEditor->getText().empty()) { showError("no_google_api_key"); return false; @@ -129,7 +129,7 @@ void LLFloaterTranslationSettings::updateControlsEnabledState() mGoogleAPIKeyEditor->setEnabled(on); mBingAPIKeyEditor->setEnabled(service == "bing"); - mGoogleAPIKeyEditor->setEnabled(service == "google_v2"); + mGoogleAPIKeyEditor->setEnabled(service == "google"); } void LLFloaterTranslationSettings::onBtnOK() @@ -140,7 +140,7 @@ void LLFloaterTranslationSettings::onBtnOK() gSavedSettings.setString("TranslateLanguage", mLanguageCombo->getSelectedValue().asString()); gSavedSettings.setString("TranslationService", getSelectedService()); gSavedSettings.setString("BingTranslateAPIKey", mBingAPIKeyEditor->getText()); - gSavedSettings.setString("GoogleTranslateAPIv2Key", mGoogleAPIKeyEditor->getText()); + gSavedSettings.setString("GoogleTranslateAPIKey", mGoogleAPIKeyEditor->getText()); closeFloater(false); } } diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index e29ea373ce..6576cbbe64 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -59,57 +59,9 @@ protected: static const int STATUS_OK = 200; }; -class LLGoogleV1Handler : public LLTranslationAPIHandler +class LLGoogleHandler : public LLTranslationAPIHandler { - LOG_CLASS(LLGoogleV1Handler); - -public: - /*virtual*/ void getTranslateURL( - std::string &url, - const std::string &from_lang, - const std::string &to_lang, - const std::string &text) const - { - url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" - + LLURI::escape(text) - + "&langpair=" + from_lang + "%7C" + to_lang; - } - - /*virtual*/ bool parseResponse( - int& status, - const std::string& body, - std::string& translation, - std::string& detected_lang, - std::string& err_msg) const - { - Json::Value root; - Json::Reader reader; - - if (!reader.parse(body, root)) - { - err_msg = reader.getFormatedErrorMessages(); - return false; - } - - // This API doesn't return proper status in the HTTP response header, - // but it is in the body. - status = root["responseStatus"].asInt(); - if (status != STATUS_OK) - { - err_msg = root["responseDetails"].asString(); - return false; - } - - const Json::Value& response_data = root["responseData"]; - translation = response_data.get("translatedText", "").asString(); - detected_lang = response_data.get("detectedSourceLanguage", "").asString(); - return true; - } -}; - -class LLGoogleV2Handler : public LLTranslationAPIHandler -{ - LOG_CLASS(LLGoogleV2Handler); + LOG_CLASS(LLGoogleHandler); public: /*virtual*/ void getTranslateURL( @@ -159,7 +111,7 @@ public: private: static std::string getAPIKey() { - return gSavedSettings.getString("GoogleTranslateAPIv2Key"); + return gSavedSettings.getString("GoogleTranslateAPIKey"); } }; @@ -311,18 +263,13 @@ std::string LLTranslate::getTranslateLanguage() // static const LLTranslationAPIHandler& LLTranslate::getPreferredHandler() { - static LLGoogleV1Handler google_v1; - static LLGoogleV2Handler google_v2; - static LLBingHandler bing; + static LLGoogleHandler google; + static LLBingHandler bing; std::string service = gSavedSettings.getString("TranslationService"); - if (service == "google_v2") - { - return google_v2; - } - else if (service == "google_v1") + if (service == "google") { - return google_v1; + return google; } return bing; diff --git a/indra/newview/skins/default/xui/en/floater_translation_settings.xml b/indra/newview/skins/default/xui/en/floater_translation_settings.xml index 40a176830c..f21f64fcf6 100644 --- a/indra/newview/skins/default/xui/en/floater_translation_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml @@ -137,10 +137,10 @@ layout="topleft" name="bing" /> -- cgit v1.2.3 From 1fad7d997d99715cc88b6e69ae325f28be413206 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 7 Sep 2011 19:12:35 +0300 Subject: STORM-1577 Made parsing translation responses more robust. JsonCpp is prone to aborting the program on failed assertions, so be super-careful and verify the response format. --- indra/newview/lltranslate.cpp | 72 +++++++++++++++++++++++--- indra/newview/skins/default/xui/en/strings.xml | 3 ++ 2 files changed, 67 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 6576cbbe64..895d8f78eb 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -31,6 +31,7 @@ #include #include "llbufferstream.h" +#include "lltrans.h" #include "llui.h" #include "llversioninfo.h" #include "llviewercontrol.h" @@ -94,21 +95,66 @@ public: return false; } + if (!root.isObject()) // empty response? should not happen + { + return false; + } + if (status != STATUS_OK) { - const Json::Value& error = root["error"]; - err_msg = error["message"].asString(); - status = error["code"].asInt(); + // Request failed. Extract error message from the response. + parseErrorResponse(root, status, err_msg); return false; } - const Json::Value& response_data = root["data"]["translations"][0U]; - translation = response_data["translatedText"].asString(); - detected_lang = response_data["detectedSourceLanguage"].asString(); - return true; + // Request succeeded, extract translation from the response. + return parseTranslation(root, translation, detected_lang); } private: + static void parseErrorResponse( + const Json::Value& root, + int& status, + std::string& err_msg) + { + const Json::Value& error = root.get("error", 0); + if (!error.isObject() || !error.isMember("message") || !error.isMember("code")) + { + return; + } + + err_msg = error["message"].asString(); + status = error["code"].asInt(); + } + + static bool parseTranslation( + const Json::Value& root, + std::string& translation, + std::string& detected_lang) + { + const Json::Value& data = root.get("data", 0); + if (!data.isObject() || !data.isMember("translations")) + { + return false; + } + + const Json::Value& translations = data["translations"]; + if (!translations.isArray() || translations.size() == 0) + { + return false; + } + + const Json::Value& first = translations[0U]; + if (!first.isObject() || !first.isMember("translatedText")) + { + return false; + } + + translation = first["translatedText"].asString(); + detected_lang = first.get("detectedSourceLanguage", "").asString(); + return true; + } + static std::string getAPIKey() { return gSavedSettings.getString("GoogleTranslateAPIKey"); @@ -143,7 +189,12 @@ public: { if (status != STATUS_OK) { - size_t begin = body.find("Message: "); + static const std::string MSG_BEGIN_MARKER = "Message: "; + size_t begin = body.find(MSG_BEGIN_MARKER); + if (begin != std::string::npos) + { + begin += MSG_BEGIN_MARKER.size(); + } size_t end = body.find("

", begin); err_msg = body.substr(begin, end-begin); LLStringUtil::replaceString(err_msg, " ", ""); // strip CR @@ -211,6 +262,11 @@ void LLTranslate::TranslationReceiver::completedRaw( } else { + if (err_msg.empty()) + { + err_msg = LLTrans::getString("TranslationResponseParseError"); + } + 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; diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2094275bed..146665b47d 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3502,6 +3502,9 @@ Try enclosing path to the editor with double quotes. Error parsing the external editor command. External editor failed to run. + + Error parsing translation response. + Esc Space -- cgit v1.2.3 From ef01821337a0dc428fd090ae94c8cc9d9a13bdb5 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 7 Sep 2011 19:29:57 +0300 Subject: STORM-1577 WIP Removed old translation settings controls. They are now superceded with a separate floater. --- .../default/xui/en/panel_preferences_chat.xml | 119 +-------------------- 1 file changed, 2 insertions(+), 117 deletions(-) (limited to 'indra') 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 3fbf484ab2..28db34f4d4 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -204,129 +204,14 @@ name="nearby_toasts_fadingtime" top_pad="3" width="325" /> - - - - - Use machine translation while chatting (powered by Google) - - - Translate chat into: - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From cd13933b0942ef4fdf2d4ec8f558d0ec2312b691 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 24 Oct 2011 14:14:55 -0700 Subject: EXP-1354 : Fixed. Toolbars now saved whenever changing their config and only if initialized correctly. --- indra/newview/lltoolbarview.cpp | 14 +++++++++++++- indra/newview/lltoolbarview.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index affa7241d1..f481455834 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -73,7 +73,8 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) mToolbarRight(NULL), mToolbarBottom(NULL), mDragStarted(false), - mDragToolbarButton(NULL) + mDragToolbarButton(NULL), + mToolbarsLoaded(false) { } @@ -244,6 +245,7 @@ bool LLToolBarView::loadToolbars(bool force_default) } } } + mToolbarsLoaded = true; return true; } @@ -255,6 +257,10 @@ bool LLToolBarView::loadDefaultToolbars() if (gToolBarView) { retval = gToolBarView->loadToolbars(true); + if (retval) + { + gToolBarView->saveToolbars(); + } } return retval; @@ -262,6 +268,9 @@ bool LLToolBarView::loadDefaultToolbars() void LLToolBarView::saveToolbars() const { + if (!mToolbarsLoaded) + return; + // Build the parameter tree from the toolbar data LLToolBarView::ToolbarSet toolbar_set; if (mToolbarLeft) @@ -460,6 +469,9 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t int new_rank = toolbar->getRankFromPosition(x,y); toolbar->addCommand(command_id, new_rank); } + + // Save the new toolbars configuration + gToolBarView->saveToolbars(); } else { diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index 8cafbc9308..ea14e471cd 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -100,6 +100,7 @@ private: LLToolBar* mToolbarLeft; LLToolBar* mToolbarRight; LLToolBar* mToolbarBottom; + bool mToolbarsLoaded; bool mDragStarted; LLToolBarButton* mDragToolbarButton; -- cgit v1.2.3 From 399de4f345eb0bf43e84bf0a65b3251798f59a13 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 24 Oct 2011 14:28:09 -0700 Subject: EXP-1454 FIX People floater 'cascades' as if opening a new window while looking at group profiles --- indra/llui/llfloater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 7100ea13a7..2c707afa8f 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -935,7 +935,7 @@ void LLFloater::applyPositioning(LLFloater* other) case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP: case LLFloaterEnums::OPEN_POSITIONING_CASCADING: - if (other != NULL) + if (other != NULL && other != this) { stackWith(*other); } -- cgit v1.2.3 From c6c15aacb394f6ccff77625653591927e450c897 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 24 Oct 2011 14:36:41 -0700 Subject: WIP INTL-78 Turkish translation for FUI --- .../newview/skins/default/xui/tr/floater_about.xml | 5 +- .../skins/default/xui/tr/floater_about_land.xml | 6 +- .../skins/default/xui/tr/floater_avatar.xml | 2 + .../skins/default/xui/tr/floater_camera.xml | 2 +- .../skins/default/xui/tr/floater_chat_bar.xml | 7 + .../skins/default/xui/tr/floater_destinations.xml | 2 + .../skins/default/xui/tr/floater_fast_timers.xml | 10 + .../skins/default/xui/tr/floater_how_to.xml | 2 + indra/newview/skins/default/xui/tr/floater_map.xml | 4 +- .../skins/default/xui/tr/floater_model_preview.xml | 376 +++++++++++---------- .../skins/default/xui/tr/floater_model_wizard.xml | 122 ++----- .../skins/default/xui/tr/floater_moveview.xml | 2 +- .../skins/default/xui/tr/floater_my_appearance.xml | 4 + .../skins/default/xui/tr/floater_my_inventory.xml | 2 + .../default/xui/tr/floater_object_weights.xml | 28 ++ .../default/xui/tr/floater_outfit_save_as.xml | 2 +- .../skins/default/xui/tr/floater_people.xml | 7 + .../newview/skins/default/xui/tr/floater_picks.xml | 2 + .../skins/default/xui/tr/floater_places.xml | 4 + .../skins/default/xui/tr/floater_sound_devices.xml | 2 +- .../newview/skins/default/xui/tr/floater_stats.xml | 12 +- .../newview/skins/default/xui/tr/floater_tools.xml | 11 +- .../skins/default/xui/tr/floater_toybox.xml | 10 + .../default/xui/tr/floater_voice_controls.xml | 8 +- .../skins/default/xui/tr/menu_bottomtray.xml | 2 +- .../skins/default/xui/tr/menu_hide_navbar.xml | 2 +- indra/newview/skins/default/xui/tr/menu_login.xml | 2 +- .../newview/skins/default/xui/tr/menu_toolbars.xml | 6 + indra/newview/skins/default/xui/tr/menu_viewer.xml | 27 +- .../newview/skins/default/xui/tr/notifications.xml | 14 +- .../skins/default/xui/tr/panel_chiclet_bar.xml | 15 + indra/newview/skins/default/xui/tr/panel_me.xml | 5 +- .../skins/default/xui/tr/panel_navigation_bar.xml | 35 +- .../skins/default/xui/tr/panel_nearby_chat.xml | 4 + .../default/xui/tr/panel_preferences_chat.xml | 2 +- .../default/xui/tr/panel_preferences_general.xml | 4 +- .../default/xui/tr/panel_preferences_move.xml | 31 +- .../skins/default/xui/tr/panel_status_bar.xml | 7 +- .../skins/default/xui/tr/sidepanel_inventory.xml | 14 +- indra/newview/skins/default/xui/tr/strings.xml | 189 ++++++++++- 40 files changed, 628 insertions(+), 363 deletions(-) create mode 100644 indra/newview/skins/default/xui/tr/floater_avatar.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_chat_bar.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_destinations.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_fast_timers.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_how_to.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_my_appearance.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_my_inventory.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_object_weights.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_people.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_picks.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_places.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_toybox.xml create mode 100644 indra/newview/skins/default/xui/tr/menu_toolbars.xml create mode 100644 indra/newview/skins/default/xui/tr/panel_chiclet_bar.xml create mode 100644 indra/newview/skins/default/xui/tr/panel_nearby_chat.xml (limited to 'indra') diff --git a/indra/newview/skins/default/xui/tr/floater_about.xml b/indra/newview/skins/default/xui/tr/floater_about.xml index 2fdbafdfb4..998890b85c 100644 --- a/indra/newview/skins/default/xui/tr/floater_about.xml +++ b/indra/newview/skins/default/xui/tr/floater_about.xml @@ -10,7 +10,7 @@ <nolink>[HOSTNAME]</nolink> ([HOSTIP]) üzerinde bulunan [REGION] içerisinde [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] konumundasınız [SERVER_VERSION] -[[SERVER_RELEASE_NOTES_URL] [Sürüm Notları]] +[SERVER_RELEASE_NOTES_URL] CPU: [CPU] @@ -37,6 +37,9 @@ Ses Sunucusu Sürümü: [VOICE_VERSION] Kaybolan Paketler: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%) + + Sunucu sürümü notları URL'si alınırken hata oluştu. + -- cgit v1.2.3 From 56b2e4ac7c7cc4f27f08b4024ecbeace4c3a3e51 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 25 Oct 2011 16:36:27 +0200 Subject: STORM-1577 WIP Indented floater contents. --- .../default/xui/en/floater_translation_settings.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_translation_settings.xml b/indra/newview/skins/default/xui/en/floater_translation_settings.xml index 1eb75e40f3..40fdaaed66 100644 --- a/indra/newview/skins/default/xui/en/floater_translation_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml @@ -7,7 +7,7 @@ help_topic="environment_editor_floater" save_rect="true" title="CHAT TRANSLATION SETTINGS" - width="480"> + width="485"> Bing appID not verified. Please try again. Google API key not verified. Please try again. @@ -27,7 +27,7 @@ height="20" follows="left|top" layout="topleft" - left="10" + left="40" name="translate_language_label" top_pad="20" width="130"> @@ -118,7 +118,7 @@ follows="top|left|right" height="15" layout="topleft" - left="10" + left="40" name="tip" top_pad="20" width="330" @@ -153,10 +153,10 @@ follows="top|right" height="20" layout="topleft" - left="40" + left="70" name="bing_api_key_label" top_pad="-55" - width="100"> + width="85"> Bing [http://www.bing.com/developers/createapp.aspx AppID]: + width="210" /> + + + +
-- cgit v1.2.3 From 95da0d5421b86b3c01fc372db28d7aa568ef0b16 Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 26 Oct 2011 18:45:06 -0700 Subject: FIX VWR-27349 Fix incorrect language name vs. native script name formats for Chinese --- .../skins/default/xui/zh/panel_preferences_general.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/zh/panel_preferences_general.xml b/indra/newview/skins/default/xui/zh/panel_preferences_general.xml index 29f9599c97..6827fab6e6 100644 --- a/indra/newview/skins/default/xui/zh/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/zh/panel_preferences_general.xml @@ -5,15 +5,15 @@ - - - - - - - - - + + + + + + + + + (須重新啟動) -- cgit v1.2.3 From 0c84957d312bc3dc31fdb5711317157df73b72e6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Oct 2011 14:50:54 -0400 Subject: SH-2606 FIX, SH-2628 FIX - crash on exit in crash logger fixed by LLProxy::cleanupClass() --- indra/linux_crash_logger/llcrashloggerlinux.cpp | 6 ++++++ indra/linux_crash_logger/llcrashloggerlinux.h | 1 + indra/llcrashlogger/llcrashlogger.cpp | 7 +++++++ indra/llcrashlogger/llcrashlogger.h | 3 ++- indra/mac_crash_logger/llcrashloggermac.cpp | 1 + indra/win_crash_logger/llcrashloggerwindows.cpp | 1 + 6 files changed, 18 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/linux_crash_logger/llcrashloggerlinux.cpp mode change 100644 => 100755 indra/linux_crash_logger/llcrashloggerlinux.h mode change 100644 => 100755 indra/llcrashlogger/llcrashlogger.cpp mode change 100644 => 100755 indra/llcrashlogger/llcrashlogger.h mode change 100644 => 100755 indra/mac_crash_logger/llcrashloggermac.cpp mode change 100644 => 100755 indra/win_crash_logger/llcrashloggerwindows.cpp (limited to 'indra') diff --git a/indra/linux_crash_logger/llcrashloggerlinux.cpp b/indra/linux_crash_logger/llcrashloggerlinux.cpp old mode 100644 new mode 100755 index 7316717193..62465f9937 --- a/indra/linux_crash_logger/llcrashloggerlinux.cpp +++ b/indra/linux_crash_logger/llcrashloggerlinux.cpp @@ -133,6 +133,12 @@ bool LLCrashLoggerLinux::mainLoop() return true; } +bool LLCrashLoggerLinux::cleanup() +{ + commonCleanup(); + return true; +} + void LLCrashLoggerLinux::updateApplication(const std::string& message) { LLCrashLogger::updateApplication(message); diff --git a/indra/linux_crash_logger/llcrashloggerlinux.h b/indra/linux_crash_logger/llcrashloggerlinux.h old mode 100644 new mode 100755 index 65d5e4e653..dae6c46651 --- a/indra/linux_crash_logger/llcrashloggerlinux.h +++ b/indra/linux_crash_logger/llcrashloggerlinux.h @@ -39,6 +39,7 @@ public: virtual bool mainLoop(); virtual void updateApplication(const std::string& = LLStringUtil::null); virtual void gatherPlatformSpecificFiles(); + virtual bool cleanup(); }; #endif diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp old mode 100644 new mode 100755 index 331a1692ee..3461aa3e6c --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -42,6 +42,7 @@ #include "llpumpio.h" #include "llhttpclient.h" #include "llsdserialize.h" +#include "llproxy.h" LLPumpIO* gServicePump; BOOL gBreak = false; @@ -428,3 +429,9 @@ bool LLCrashLogger::init() return true; } + +// For cleanup code common to all platforms. +void LLCrashLogger::commonCleanup() +{ + LLProxy::cleanupClass(); +} diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h old mode 100644 new mode 100755 index 5d0cb5931c..1510d7e0b3 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -48,7 +48,8 @@ public: virtual void updateApplication(const std::string& message = LLStringUtil::null); virtual bool init(); virtual bool mainLoop() = 0; - virtual bool cleanup() { return true; } + virtual bool cleanup() = 0; + void commonCleanup(); void setUserText(const std::string& text) { mCrashInfo["UserNotes"] = text; } S32 getCrashBehavior() { return mCrashBehavior; } bool runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout); diff --git a/indra/mac_crash_logger/llcrashloggermac.cpp b/indra/mac_crash_logger/llcrashloggermac.cpp old mode 100644 new mode 100755 index b555e92b96..8f1c1a2dd0 --- a/indra/mac_crash_logger/llcrashloggermac.cpp +++ b/indra/mac_crash_logger/llcrashloggermac.cpp @@ -249,5 +249,6 @@ void LLCrashLoggerMac::updateApplication(const std::string& message) bool LLCrashLoggerMac::cleanup() { + commonCleanup(); return true; } diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp old mode 100644 new mode 100755 index 170babbb98..36d988ead7 --- a/indra/win_crash_logger/llcrashloggerwindows.cpp +++ b/indra/win_crash_logger/llcrashloggerwindows.cpp @@ -370,5 +370,6 @@ bool LLCrashLoggerWindows::cleanup() sleep_and_pump_messages(3); } PostQuitMessage(0); + commonCleanup(); return true; } -- cgit v1.2.3 From 5c868a90f2e30245771aa1ef402645d6d3f12ab1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Oct 2011 17:39:07 -0400 Subject: SH-2635 FIX - always send crash report if previous session froze --- indra/newview/llappviewer.cpp | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) mode change 100644 => 100755 indra/newview/llappviewer.cpp (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp old mode 100644 new mode 100755 index ecfd101eeb..dc88c81d6a --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2825,48 +2825,15 @@ void LLAppViewer::initUpdater() void LLAppViewer::checkForCrash(void) { - #if LL_SEND_CRASH_REPORTS if (gLastExecEvent == LAST_EXEC_FROZE) { - llinfos << "Last execution froze, requesting to send crash report." << llendl; - // - // Pop up a freeze or crash warning dialog - // - S32 choice; - const S32 cb = gCrashSettings.getS32("CrashSubmitBehavior"); - if(cb == CRASH_BEHAVIOR_ASK) - { - std::ostringstream msg; - msg << LLTrans::getString("MBFrozenCrashed"); - std::string alert = LLTrans::getString("APP_NAME") + " " + LLTrans::getString("MBAlert"); - choice = OSMessageBox(msg.str(), - alert, - OSMB_YESNO); - } - else if(cb == CRASH_BEHAVIOR_NEVER_SEND) - { - choice = OSBTN_NO; - } - else - { - choice = OSBTN_YES; - } - - if (OSBTN_YES == choice) - { - llinfos << "Sending crash report." << llendl; + llinfos << "Last execution froze, sending a crash report." << llendl; - bool report_freeze = true; - handleCrashReporting(report_freeze); - } - else - { - llinfos << "Not sending crash report." << llendl; - } + bool report_freeze = true; + handleCrashReporting(report_freeze); } #endif // LL_SEND_CRASH_REPORTS - } // -- cgit v1.2.3 From e86adb53f4df0cb0b9d8ea9b6cc805782d9fcf71 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 27 Oct 2011 17:20:12 -0700 Subject: EXP-1479 FIX Chat history does not open when selecting toggle on chat floater and issue with minimizing and opening chat floater --- indra/newview/skins/default/xui/en/floater_chat_bar.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml index e7eb7652c7..87606c1a2a 100644 --- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml +++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml @@ -24,7 +24,7 @@ follow="all" width="380" height="0" - visible="true" + visible="false" filename="panel_nearby_chat.xml" name="nearby_chat" /> Date: Fri, 28 Oct 2011 16:27:34 -0700 Subject: sync with viewer-development --- .../newview/skins/default/xui/da/floater_about.xml | 2 +- .../xui/en/floater_translation_settings.xml | 244 +++++++++++++++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 10 + .../default/xui/en/panel_preferences_chat.xml | 127 +---------- indra/newview/skins/default/xui/en/strings.xml | 6 + .../newview/skins/default/xui/pl/floater_about.xml | 2 +- indra/newview/skins/default/xui/ru/strings.xml | 2 +- .../newview/skins/default/xui/zh/floater_about.xml | 2 +- 8 files changed, 276 insertions(+), 119 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_translation_settings.xml (limited to 'indra') diff --git a/indra/newview/skins/default/xui/da/floater_about.xml b/indra/newview/skins/default/xui/da/floater_about.xml index 0ccaab73ba..fc8bc33096 100644 --- a/indra/newview/skins/default/xui/da/floater_about.xml +++ b/indra/newview/skins/default/xui/da/floater_about.xml @@ -10,7 +10,7 @@ Du er ved [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] i regionen [REGION] lokaliseret ved <nolink>[HOSTNAME]</nolink> ([HOSTIP]) [SERVER_VERSION] -[[SERVER_RELEASE_NOTES_URL] [ReleaseNotes]] +[SERVER_RELEASE_NOTES_URL] CPU: [CPU] 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..c03f751265 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml @@ -0,0 +1,244 @@ + + + + Bing appID not verified. Please try again. + Google API key not verified. Please try again. + + Bing appID verified. + Google API key verified. + + + + Translate chat into: + + + + + + + + + + + + + + + + + + + + + + + + Choose translation service: + + + + + + + + + Bing [http://www.bing.com/developers/createapp.aspx AppID]: + + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index c4031de0f8..24cec13c4c 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2183,6 +2183,8 @@ Returns a string with the requested data about the region Stomach Left Pec Right Pec + Neck + Avatar Center Invalid Attachment Point @@ -3529,6 +3531,10 @@ Try enclosing path to the editor with double quotes. Error parsing the external editor command. External editor failed to run. + + Translation failed: [REASON] + Error parsing translation response. + Esc Space diff --git a/indra/newview/skins/default/xui/pl/floater_about.xml b/indra/newview/skins/default/xui/pl/floater_about.xml index 637325ddd0..409429ffaa 100644 --- a/indra/newview/skins/default/xui/pl/floater_about.xml +++ b/indra/newview/skins/default/xui/pl/floater_about.xml @@ -10,7 +10,7 @@ Położenie [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] w [REGION] zlokalizowanym w <nolink>[HOSTNAME]</nolink> ([HOSTIP]) [SERVER_VERSION] -[[SERVER_RELEASE_NOTES_URL] [ReleaseNotes]] +[SERVER_RELEASE_NOTES_URL] Procesor: [CPU] diff --git a/indra/newview/skins/default/xui/ru/strings.xml b/indra/newview/skins/default/xui/ru/strings.xml index d52cee6b0d..0134298166 100644 --- a/indra/newview/skins/default/xui/ru/strings.xml +++ b/indra/newview/skins/default/xui/ru/strings.xml @@ -4252,7 +4252,7 @@ support@secondlife.com. Женщина – ух ты! - /поклониться + /поклон /хлопнуть diff --git a/indra/newview/skins/default/xui/zh/floater_about.xml b/indra/newview/skins/default/xui/zh/floater_about.xml index 0ac85d399e..7e19c124a1 100644 --- a/indra/newview/skins/default/xui/zh/floater_about.xml +++ b/indra/newview/skins/default/xui/zh/floater_about.xml @@ -10,7 +10,7 @@ You are at [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] in [REGION] located at <nolink>[HOSTNAME]</nolink> ([HOSTIP]) [SERVER_VERSION] -[[SERVER_RELEASE_NOTES_URL] [ReleaseNotes]] +[SERVER_RELEASE_NOTES_URL] CPU:[CPU] -- cgit v1.2.3