summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-07-14 18:18:47 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-07-14 18:18:47 +0300
commit223b25de0d2584af13f38b8eea128a32c62dc9f3 (patch)
tree844517b65efeb3f9c83759933a6bca3bf6934837 /indra/newview
parent706e75dff3afafbec9dd6ca2266c8b6c1bdb6689 (diff)
EXT-8400 FIXED Updated default inventory item names ("New Script", etc) on viewer language switch.
Bug reason ========== New inventory items get names like "New Script", "New Undershirt" etc., but the names are translated on-the-fly (see EXT-5839), so the user actually sees "Nouveau script", "Nouveau débardeur" etc., respectively. However when the user changes viewer language, the old localized names still exist in the inventory cache, so, for example, if you create an undershirt in French and then switch to Enlgish, the undershirt will be named "Nouveau d bardeur", which is the old cached localized name with non-ASCII characters replaced with spaces. Fix === To get rid of obsolete translations I clear all caches whenever viewer language gets changed. Other changes ============= - Added a check for agent region being NULL to LLAgentLanguage::update(). - Removed LLAgentLanguage constructor and base classes because it's never instantiated. Reviewed by Seraph at https://codereview.productengine.com/secondlife/r/744/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llagentlanguage.cpp26
-rw-r--r--indra/newview/llagentlanguage.h10
-rw-r--r--indra/newview/llappviewer.cpp3
3 files changed, 28 insertions, 11 deletions
diff --git a/indra/newview/llagentlanguage.cpp b/indra/newview/llagentlanguage.cpp
index e97f136489..3d4e34a549 100644
--- a/indra/newview/llagentlanguage.cpp
+++ b/indra/newview/llagentlanguage.cpp
@@ -39,21 +39,35 @@
// library includes
#include "llui.h" // getLanguage()
-LLAgentLanguage::LLAgentLanguage()
+// static
+void LLAgentLanguage::init()
{
- gSavedSettings.getControl("Language")->getSignal()->connect(boost::bind(&update));
- gSavedSettings.getControl("InstallLanguage")->getSignal()->connect(boost::bind(&update));
- gSavedSettings.getControl("SystemLanguage")->getSignal()->connect(boost::bind(&update));
- gSavedSettings.getControl("LanguageIsPublic")->getSignal()->connect(boost::bind(&update));
+ gSavedSettings.getControl("Language")->getSignal()->connect(boost::bind(&onChange));
+ gSavedSettings.getControl("InstallLanguage")->getSignal()->connect(boost::bind(&onChange));
+ gSavedSettings.getControl("SystemLanguage")->getSignal()->connect(boost::bind(&onChange));
+ gSavedSettings.getControl("LanguageIsPublic")->getSignal()->connect(boost::bind(&onChange));
}
+// static
+void LLAgentLanguage::onChange()
+{
+ // Clear inventory cache so that default names of inventory items
+ // appear retranslated (EXT-8308).
+ gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
+}
// send language settings to the sim
// static
bool LLAgentLanguage::update()
{
LLSD body;
- std::string url = gAgent.getRegion()->getCapability("UpdateAgentLanguage");
+ std::string url;
+
+ if (gAgent.getRegion())
+ {
+ url = gAgent.getRegion()->getCapability("UpdateAgentLanguage");
+ }
+
if (!url.empty())
{
std::string language = LLUI::getLanguage();
diff --git a/indra/newview/llagentlanguage.h b/indra/newview/llagentlanguage.h
index 45348a1e50..d7e6f3c6c7 100644
--- a/indra/newview/llagentlanguage.h
+++ b/indra/newview/llagentlanguage.h
@@ -33,14 +33,14 @@
#ifndef LL_LLAGENTLANGUAGE_H
#define LL_LLAGENTLANGUAGE_H
-#include "llsingleton.h" // LLSingleton<>
-#include "llevent.h"
-
-class LLAgentLanguage: public LLSingleton<LLAgentLanguage>, public LLOldEvents::LLSimpleListener
+class LLAgentLanguage
{
public:
- LLAgentLanguage();
+ static void init();
static bool update();
+
+ private:
+ static void onChange();
};
#endif // LL_LLAGENTLANGUAGE_H
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 682e3eb874..6869cf3e64 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -45,6 +45,7 @@
#include "llgroupmgr.h"
#include "llagent.h"
#include "llagentcamera.h"
+#include "llagentlanguage.h"
#include "llagentwearables.h"
#include "llwindow.h"
#include "llviewerstats.h"
@@ -946,6 +947,8 @@ bool LLAppViewer::init()
LLStringOps::sPM = LLTrans::getString("dateTimePM");
}
+ LLAgentLanguage::init();
+
return true;
}