diff options
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 e13d73c640..7619e4b7ac 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 <map> @@ -154,13 +155,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 +198,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; } } |