Пример #1
0
//static 
std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
{
	// Singu note: make sure LLTrans isn't used in a tight loop.
	if (sStringTemplates_accesses++ % access_increment == access_increment - 1) log_sStringTemplates_accesses();

	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);
		
		return text;
	}
	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);
		
		return "MissingString("+xml_desc+")";
	}
}
Пример #2
0
//static 
std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& 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_map_t args = sDefaultArgs;
		args.insert(msg_args.begin(), msg_args.end());
		LLStringUtil::format(text, args);
		
		return text;
	}
	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); // *TODO: resurrect
		//return xml_desc;

		return "MissingString("+xml_desc+")";
	}
}
Пример #3
0
void chat_avatar_status(std::string name, LLUUID key, ERadarAlertType type, bool entering)
{
	static LLCachedControl<bool> radar_chat_alerts(gSavedSettings, "RadarChatAlerts");
	if (!radar_chat_alerts) return;
	static LLCachedControl<bool> radar_alert_sim(gSavedSettings, "RadarAlertSim");
	static LLCachedControl<bool> radar_alert_draw(gSavedSettings, "RadarAlertDraw");
	static LLCachedControl<bool> radar_alert_shout_range(gSavedSettings, "RadarAlertShoutRange");
	static LLCachedControl<bool> radar_alert_chat_range(gSavedSettings, "RadarAlertChatRange");
	static LLCachedControl<bool> radar_chat_keys(gSavedSettings, "RadarChatKeys");

	LLFloaterAvatarList* self = LLFloaterAvatarList::getInstance();
	LLStringUtil::format_map_t args;
	switch(type)
	{
		case ALERT_TYPE_SIM:
			if (radar_alert_sim)
			{
				args["[RANGE]"] = self->getString("the_sim");
			}
			break;

		case ALERT_TYPE_DRAW:
			if (radar_alert_draw)
			{
				args["[RANGE]"] = self->getString("draw_distance");
			}
			break;

		case ALERT_TYPE_SHOUTRANGE:
			if (radar_alert_shout_range)
			{
				args["[RANGE]"] = self->getString("shout_range");
			}
			break;

		case ALERT_TYPE_CHATRANGE:
			if (radar_alert_chat_range)
			{
				args["[RANGE]"] = self->getString("chat_range");
			}
			break;
	}
	if (args.find("[RANGE]") != args.end())
	{
		args["[NAME]"] = name;
		args["[ACTION]"] = self->getString(entering ? "has_entered" : "has_left");
		LLChat chat;
		chat.mText = self->getString("template", args);
		chat.mFromName = name;
		chat.mURL = llformat("secondlife:///app/agent/%s/about",key.asString().c_str());
		chat.mSourceType = CHAT_SOURCE_SYSTEM;
		LLFloaterChat::addChat(chat);
	}
}
Пример #4
0
//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
	{
		LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;	
		return false;
	}
}
Пример #5
0
//static 
bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
{
	// Singu note: make sure LLTrans isn't used in a tight loop.
	if (sStringTemplates_accesses++ % access_increment == 0) log_sStringTemplates_accesses();

	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
	{
		LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;	
		return false;
	}
}