summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-04-19 13:54:50 -0700
committerJames Cook <james@lindenlab.com>2010-04-19 13:54:50 -0700
commit16aa2a2a0f29fa927455e616817eef2bedbbf7a7 (patch)
tree632d76df24492aef0b8426591889f4d979231e2b /indra/newview
parentd38727e47ba5d7dd449c6ba62ac6c988ac66236f (diff)
DEV-49149 Localizable server error message for Display Names
Try to look up a specific translation for the error in the viewer, but failing that, try to use a message sent by the server. Reviewed with Simon.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelme.cpp36
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml9
2 files changed, 35 insertions, 10 deletions
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index d81d84767b..c4fe613161 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -45,8 +45,8 @@
// Linden libraries
#include "llavatarnamecache.h" // IDEVO
-#include "llchat.h" // IDEVO HACK
#include "lliconctrl.h"
+#include "llnotifications.h"
#include "llnotificationsutil.h" // IDEVO
#include "lltabcontainer.h"
#include "lltexturectrl.h"
@@ -298,9 +298,6 @@ void LLPanelMyProfileEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl)
mTextureEditIconMap[ctrl->getName()]->setVisible(FALSE);
}
-// IDEVO HACK
-extern void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
-
void LLPanelMyProfileEdit::onCacheSetName(bool success,
const std::string& reason,
const LLSD& content)
@@ -310,15 +307,34 @@ void LLPanelMyProfileEdit::onCacheSetName(bool success,
// Re-fetch my name, as it may have been sanitized by the service
LLAvatarNameCache::get(getAvatarId(),
boost::bind(&LLPanelMyProfileEdit::onNameCache, this, _1, _2));
+ return;
}
- else
+
+ // Request failed, notify the user
+ std::string error_tag = content["error_tag"].asString();
+ llinfos << "set name failure error_tag " << error_tag << llendl;
+
+ // We might have a localized string for this message
+ if (!error_tag.empty()
+ && LLNotifications::getInstance()->templateExists(error_tag))
{
- // JAMESDEBUG TODO: localize strings for reasons we couldn't
- // change the name
- LLNotificationsUtil::add("SetDisplayNameFailedGeneric");
- // TODO: SetDisplayNameFailedThrottle with [FREQUENCY]
- // TODO: SetDisplayNameFailedUnavailable
+ LLNotificationsUtil::add(error_tag);
+ return;
}
+
+ // The server error might have a localized message for us
+ std::string lang_code = LLUI::getLanguage();
+ LLSD error_desc = content["error_description"];
+ if (error_desc.has( lang_code ))
+ {
+ LLSD args;
+ args["MESSAGE"] = error_desc[lang_code].asString();
+ LLNotificationsUtil::add("GenericAlert", args);
+ return;
+ }
+
+ // No specific error, throw a generic one
+ LLNotificationsUtil::add("SetDisplayNameFailedGeneric");
}
void LLPanelMyProfileEdit::onDialogSetName(const LLSD& notification, const LLSD& response)
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index e57b21b05c..1e93c3cc98 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -3062,6 +3062,15 @@ Change your display name?
<notification
icon="alertmodal.tga"
+ name="AgentDisplayNameSetLindenFailed"
+ type="alertmodal">
+Sorry, your display name cannot contain the word 'Linden'.
+
+Please try a different name.
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="SetDisplayNameFailedThrottle"
type="alertmodal">
Sorry, you can only change your display name once every [FREQUENCY] hour(s).