diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llagentlanguage.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llagentlanguage.h | 10 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 3 |
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; } |