diff options
author | Loren Shih <seraph@lindenlab.com> | 2011-05-20 14:56:10 -0400 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2011-05-20 14:56:10 -0400 |
commit | 6f5313caea9bb8458dca23bbaf4f10cd6641c7fb (patch) | |
tree | ac34191250860e5f250cf1cc2e9199cdaa8204f6 /indra/llxuixml/lltrans.cpp | |
parent | eb8221338e0276b9afe8d92738166f97782d48d6 (diff) | |
parent | 0b612741d53a044a0179e1c32018bf8cd4213631 (diff) |
automated merge mesh-development -> davep-mesh-candidate-2010
Diffstat (limited to 'indra/llxuixml/lltrans.cpp')
-rw-r--r-- | indra/llxuixml/lltrans.cpp | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp index e13d73c640..5388069c24 100644 --- a/indra/llxuixml/lltrans.cpp +++ b/indra/llxuixml/lltrans.cpp @@ -30,6 +30,8 @@ #include "llfasttimer.h" // for call count statistics #include "llxuiparser.h" +#include "llsd.h" +#include "llxmlnode.h" #include <map> @@ -154,13 +156,28 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil:: } else { - LLSD args; - args["STRING_NAME"] = xml_desc; LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; + return "MissingString("+xml_desc+")"; + } +} - //LLNotificationsUtil::add("MissingString", args); // *TODO: resurrect - //return xml_desc; +//static +std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args) +{ + // Don't care about time as much as call count. Make sure we're not + // calling LLTrans::getString() in an inner loop. JC + LLFastTimer timer(FTM_GET_TRANS); + template_map_t::iterator iter = sStringTemplates.find(xml_desc); + if (iter != sStringTemplates.end()) + { + std::string text = iter->second.mText; + LLStringUtil::format(text, msg_args); + return text; + } + else + { + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; return "MissingString("+xml_desc+")"; } } @@ -182,11 +199,27 @@ bool LLTrans::findString(std::string &result, const std::string &xml_desc, const } else { - LLSD args; - args["STRING_NAME"] = xml_desc; - LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; - //LLNotificationsUtil::add("MissingString", args); - + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; + return false; + } +} + +//static +bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args) +{ + LLFastTimer timer(FTM_GET_TRANS); + + template_map_t::iterator iter = sStringTemplates.find(xml_desc); + if (iter != sStringTemplates.end()) + { + std::string text = iter->second.mText; + LLStringUtil::format(text, msg_args); + result = text; + return true; + } + else + { + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; return false; } } |