diff options
Diffstat (limited to 'indra/llxuixml')
-rw-r--r-- | indra/llxuixml/llinitparam.h | 1 | ||||
-rw-r--r-- | indra/llxuixml/lltrans.cpp | 25 | ||||
-rw-r--r-- | indra/llxuixml/lltrans.h | 10 | ||||
-rw-r--r-- | indra/llxuixml/llxuiparser.cpp | 4 |
4 files changed, 37 insertions, 3 deletions
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index cb56049ae2..a1d0831939 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -430,6 +430,7 @@ namespace LLInitParam const Param* getLastChangedParam() const { return mLastChangedParam ? getParamFromHandle(mLastChangedParam) : NULL; } S32 getLastChangeVersion() const { return mChangeVersion; } + bool isDefault() const { return mChangeVersion == 0; } bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack); bool serializeBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const; diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp index db7421575c..2efc475f57 100644 --- a/indra/llxuixml/lltrans.cpp +++ b/indra/llxuixml/lltrans.cpp @@ -169,3 +169,28 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil:: } } +//static +bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& 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_map_t args = sDefaultArgs; + args.insert(msg_args.begin(), msg_args.end()); + LLStringUtil::format(text, args); + result = text; + return true; + } + else + { + LLSD args; + args["STRING_NAME"] = xml_desc; + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; + //LLNotifications::instance().add("MissingString", args); + + return false; + } +} diff --git a/indra/llxuixml/lltrans.h b/indra/llxuixml/lltrans.h index 6423c88245..340d70e434 100644 --- a/indra/llxuixml/lltrans.h +++ b/indra/llxuixml/lltrans.h @@ -78,6 +78,7 @@ public: * @returns Translated string */ static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); + static bool findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& args); /** * @brief Returns a translated string @@ -89,7 +90,14 @@ public: LLStringUtil::format_map_t empty; return getString(xml_desc, empty); } - + + static bool findString(std::string &result, const std::string &xml_desc) + { + LLStringUtil::format_map_t empty; + return findString(result, xml_desc, empty); + } + + // get the default args static const LLStringUtil::format_map_t& getDefaultArgs() { diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index e1f61906e2..e28e52fd16 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -399,11 +399,11 @@ LLXUIParser::LLXUIParser() boost::bind(&LLXUIParser::writeSDValue, this, _1, _2)); } -static LLFastTimer::DeclareTimer PARSE_XUI("XUI Parsing"); +static LLFastTimer::DeclareTimer FTM_PARSE_XUI("XUI Parsing"); void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, bool silent) { - LLFastTimer timer(PARSE_XUI); + LLFastTimer timer(FTM_PARSE_XUI); mNameStack.clear(); mCurReadDepth = 0; setParseSilently(silent); |