diff --git a/code/ryzom/client/src/entity_cl.cpp b/code/ryzom/client/src/entity_cl.cpp index f09dba9f3..70c69f74e 100644 --- a/code/ryzom/client/src/entity_cl.cpp +++ b/code/ryzom/client/src/entity_cl.cpp @@ -2296,7 +2296,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) if (pos != ucstring::npos) { ucstring sn = replacement; - _EntityName = sn.substr(0, pos); + _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(sn.substr(0, pos)); ucstring::size_type pos2 = sn.find('$', pos + 1); _TitleRaw = sn.substr(pos+1, pos2 - pos - 1); replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle); @@ -2309,7 +2309,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) { // build the final name p1 = _EntityName.find('$'); - _EntityName = _EntityName.substr(0, p1); // + _Name.substr(p2+1) + _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(_EntityName.substr(0, p1)); // + _Name.substr(p2+1) // Get extended name _NameEx = replacement; newtitle = _NameEx; diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index cf83a1e0a..928360e39 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -1411,8 +1411,7 @@ const ucchar * CStringManagerClient::getSpecialWord(const std::string &label, bo if (label[0] == '#') { static ucstring rawString; - rawString = label.substr(1, label.size()-1); - return rawString.c_str(); + return getLocalizedName(label.substr(1, label.size()-1)); } // avoid case problems @@ -1615,14 +1614,41 @@ const ucchar *CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CShee const ucchar *CStringManagerClient::getTitleLocalizedName(const ucstring &titleId, bool women) { vector listInfos = getTitleInfos(titleId, women); - if (!listInfos.empty()) { _TitleWords.push_back(listInfos[0]); - return _TitleWords.back().c_str(); + return getLocalizedName(_TitleWords.back()); } - return titleId.c_str(); + return getLocalizedName(titleId); +} + +const ucchar *CStringManagerClient::getLocalizedName(const ucstring &text) +{ + if (text[0] == '%') + { + vector textLocalizations; + ucstring defaultText = ucstring(""); + splitUCString(text.substr(1), ucstring("["), textLocalizations); + if (!textLocalizations.empty()) + { + for(uint i = 0; i getTitleInfos(const ucstring &titleId, bool women); // Get the Localized name of a classification type