diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2011-06-07 17:16:49 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2011-06-07 17:16:49 -0700 |
commit | 1361eeae4e4538c175a32d48246897c4659cc26c (patch) | |
tree | 19687f65cc1c51b3247d0d1cd665b19c1a41a1e4 /indra/llxuixml/lltrans.cpp | |
parent | bff172b374fa12e646d427e09f2ffac4289ab654 (diff) | |
parent | cf31723a1a258e0452dd26d9f5eb5fcdac290e05 (diff) |
merge
Diffstat (limited to 'indra/llxuixml/lltrans.cpp')
-rw-r--r-- | indra/llxuixml/lltrans.cpp | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp index b403b86048..5388069c24 100644 --- a/indra/llxuixml/lltrans.cpp +++ b/indra/llxuixml/lltrans.cpp @@ -30,6 +30,7 @@ #include "llfasttimer.h" // for call count statistics #include "llxuiparser.h" +#include "llsd.h" #include "llxmlnode.h" #include <map> @@ -155,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+")"; } } @@ -183,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; } } |