From 98c49322c16c49eef9ef1e335b4016b4db609ac9 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Fri, 17 Sep 2010 20:11:17 +0300 Subject: STORM-153 FIXED Localized Conference and non-existent IM session name strings. - Moved the "no session" string to XML and used it in code instead of hardcode. - Conference string turned out to be already translated, but the way translation was happening ad-hoc chat log files on disk would get localized names, and thus be inconsistent (and that would create problems with browsing them later). It didn't happen already just because this string wasn't translated in other locales somewhy. So moved localization of session name after the the creation of log file. Also changed value of string according to Eli's comment in ticket. --- indra/newview/llimview.cpp | 45 +++++++++++++------------- indra/newview/llimview.h | 2 +- indra/newview/skins/default/xui/en/strings.xml | 5 ++- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 129c9aec14..493398c68a 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -69,7 +69,6 @@ const static std::string IM_TEXT("message"); const static std::string IM_FROM("from"); const static std::string IM_FROM_ID("from_id"); -const static std::string NO_SESSION("(IM Session Doesn't Exist)"); const static std::string ADHOC_NAME_SUFFIX(" Conference"); const static std::string NEARBY_P2P_BY_OTHER("nearby_P2P_by_other"); @@ -231,25 +230,6 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& new LLSessionTimeoutTimer(mSessionID, SESSION_INITIALIZATION_TIMEOUT); } - // *WORKAROUND: for server hard-coded string in indra\newsim\llsimchatterbox.cpp - if (isAdHocSessionType() && IM_SESSION_INVITE == type) - { - // For an ad-hoc incoming chat name is received from the server and is in a form of " Conference" - // Lets update it to localize the "Conference" word. See EXT-8429. - S32 separator_index = mName.rfind(" "); - std::string name = mName.substr(0, separator_index); - ++separator_index; - std::string conference_word = mName.substr(separator_index, mName.length()); - - // additional check that session name is what we expected - if ("Conference" == conference_word) - { - LLStringUtil::format_map_t args; - args["[AGENT_NAME]"] = name; - LLTrans::findString(mName, "conference-title-incoming", args); - } - } - if (IM_NOTHING_SPECIAL == type) { mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID); @@ -266,6 +246,27 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& LLLogChat::loadAllHistory(mHistoryFileName, chat_history); addMessagesFromHistory(chat_history); } + + // Localizing name of ad-hoc session. STORM-153 + // Changing name should happen here- after the history file was created, so that + // history files have consistent (English) names in different locales. + if (isAdHocSessionType() && IM_SESSION_INVITE == type) + { + // Name here has a form of " Conference" + // Lets update it to localize the "Conference" word. See EXT-8429. + S32 separator_index = mName.rfind(" "); + std::string name = mName.substr(0, separator_index); + ++separator_index; + std::string conference_word = mName.substr(separator_index, mName.length()); + + // additional check that session name is what we expected + if ("Conference" == conference_word) + { + LLStringUtil::format_map_t args; + args["[AGENT_NAME]"] = name; + LLTrans::findString(mName, "conference-title-incoming", args); + } + } } void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction) @@ -791,14 +792,14 @@ LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, } -const std::string& LLIMModel::getName(const LLUUID& session_id) const +const std::string LLIMModel::getName(const LLUUID& session_id) const { LLIMSession* session = findIMSession(session_id); if (!session) { llwarns << "session " << session_id << "does not exist " << llendl; - return NO_SESSION; + return LLTrans::getString("no_session_message"); } return session->mName; diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 4ce94773bf..ba8c7ae489 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -230,7 +230,7 @@ public: * For an incoming ad-hoc chat - is received from the server and is in a from of " Conference" * It is updated in LLIMModel::LLIMSession's constructor to localize the "Conference". */ - const std::string& getName(const LLUUID& session_id) const; + const std::string getName(const LLUUID& session_id) const; /** * Get number of unread messages in a session with session_id diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 3fa5c7afec..6b3fd9ff9e 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3029,7 +3029,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Ad-hoc Conference - [AGENT_NAME] Conference + Conference with [AGENT_NAME] Inventory item offered @@ -3039,6 +3039,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. + + (IM Session Doesn't Exist) + You are the only user in this session. -- cgit v1.2.3