summaryrefslogtreecommitdiff
path: root/indra/llui/lluistring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lluistring.cpp')
-rw-r--r--indra/llui/lluistring.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp
index 0b76b8e814..20ff71378e 100644
--- a/indra/llui/lluistring.cpp
+++ b/indra/llui/lluistring.cpp
@@ -33,9 +33,12 @@
#include "linden_common.h"
#include "lluistring.h"
#include "llsd.h"
+#include "lltrans.h"
const LLStringUtil::format_map_t LLUIString::sNullArgs;
+LLFastTimer::DeclareTimer FTM_UI_STRING("UI String");
+
LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args)
: mOrig(instring),
@@ -58,6 +61,8 @@ void LLUIString::setArgList(const LLStringUtil::format_map_t& args)
void LLUIString::setArgs(const LLSD& sd)
{
+ LLFastTimer timer(FTM_UI_STRING);
+
if (!sd.isMap()) return;
for(LLSD::map_const_iterator sd_it = sd.beginMap();
sd_it != sd.endMap();
@@ -111,7 +116,20 @@ void LLUIString::clear()
void LLUIString::format()
{
+ LLFastTimer timer(FTM_UI_STRING);
+
+ // optimize for empty strings (don't attempt string replacement)
+ if (mOrig.empty())
+ {
+ mResult.clear();
+ mWResult.clear();
+ return;
+ }
mResult = mOrig;
- LLStringUtil::format(mResult, mArgs);
+
+ // get the defailt args + local args
+ LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
+ combined_args.insert(mArgs.begin(), mArgs.end());
+ LLStringUtil::format(mResult, combined_args);
mWResult = utf8str_to_wstring(mResult);
}