Fixed: First try to add translation tags into Bot names and Titles: translating target name and sys infos

--HG--
branch : patches-from-atys
hg/hotfix/patches-from-atys
ulukyn@gmail.com 7 years ago
parent 4c91c418d4
commit 3baf7fdb12

@ -2327,6 +2327,10 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value)
_HasReservedTitle = true; _HasReservedTitle = true;
} }
} }
else
{
_EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(_EntityName);
}
} }
// Is the first title or a new title ? // Is the first title or a new title ?

@ -2066,6 +2066,7 @@ class CActionHandlerSetTargetName : public IActionHandler
} }
// Set to target // Set to target
CInterfaceExprValue evUCStr; CInterfaceExprValue evUCStr;
TargetName = STRING_MANAGER::CStringManagerClient::getLocalizedName(TargetName);
evUCStr.setUCString(TargetName); evUCStr.setUCString(TargetName);
CInterfaceLink::setTargetProperty(sNameTarget, evUCStr); CInterfaceLink::setTargetProperty(sNameTarget, evUCStr);
evUCStr.setUCString(TargetTitle); evUCStr.setUCString(TargetTitle);

@ -2356,6 +2356,7 @@ void CInterfaceManager::processServerIDString()
if (bValid) if (bValid)
{ {
ucstrToAffect = STRING_MANAGER::CStringManagerClient::getLocalizedName(ucstrToAffect);
val.setUCString (ucstrToAffect); val.setUCString (ucstrToAffect);
CInterfaceLink::setTargetProperty (pISW->Target, val); CInterfaceLink::setTargetProperty (pISW->Target, val);
} }

@ -716,6 +716,12 @@ restartLoop:
if (!getString(param.StringId, str)) if (!getString(param.StringId, str))
return false; return false;
ucstring::size_type p1 = str.find('[');
if (p1 != ucstring::npos)
{
str = str.substr(0, p1)+STRING_MANAGER::CStringManagerClient::getLocalizedName(str.substr(p1));
}
// If the string is a player name, we may have to remove the shard name (if the string looks like a player name) // If the string is a player name, we may have to remove the shard name (if the string looks like a player name)
if(!str.empty() && !PlayerSelectedHomeShardNameWithParenthesis.empty()) if(!str.empty() && !PlayerSelectedHomeShardNameWithParenthesis.empty())
{ {
@ -1623,24 +1629,27 @@ const ucchar *CStringManagerClient::getTitleLocalizedName(const ucstring &titleI
return getLocalizedName(titleId); return getLocalizedName(titleId);
} }
const ucchar *CStringManagerClient::getLocalizedName(const ucstring &text)
const ucchar *CStringManagerClient::getLocalizedName(const ucstring &uctext)
{ {
string text = uctext.toUtf8();
if (text[0] == '[') if (text[0] == '[')
{ {
vector<ucstring> textLocalizations; vector<string> textLocalizations;
ucstring defaultText = ucstring(""); static ucstring defaultText;
splitUCString(text.substr(1), ucstring("["), textLocalizations); splitString(text.substr(1), "[", textLocalizations);
if (!textLocalizations.empty()) if (!textLocalizations.empty())
{ {
for(uint i = 0; i<textLocalizations.size(); i++) for(uint i = 0; i<textLocalizations.size(); i++)
{ {
if (textLocalizations[i].substr(0, 3) == ucstring(CI18N::getCurrentLanguageCode()+"]")) if (textLocalizations[i].substr(0, 3) == CI18N::getCurrentLanguageCode()+"]")
{ {
return textLocalizations[i].substr(3).c_str(); defaultText.fromUtf8(textLocalizations[i].substr(3));
return defaultText.c_str();
} }
else if (textLocalizations[i].substr(0, 3) == ucstring("wk]")) else if (textLocalizations[i].substr(0, 3) == "wk]")
{ {
defaultText = textLocalizations[i].substr(3).c_str(); defaultText.fromUtf8(textLocalizations[i].substr(3));
} }
} }
} }
@ -1648,7 +1657,7 @@ const ucchar *CStringManagerClient::getLocalizedName(const ucstring &text)
return defaultText.c_str(); return defaultText.c_str();
} }
} }
return text.c_str(); return uctext.c_str();
} }
// *************************************************************************** // ***************************************************************************

Loading…
Cancel
Save