From 3baf7fdb1234fc8b54b7450e71207e3bb523ded8 Mon Sep 17 00:00:00 2001 From: "ulukyn@gmail.com" Date: Fri, 8 Dec 2017 23:24:03 +0100 Subject: [PATCH] Fixed: First try to add translation tags into Bot names and Titles: translating target name and sys infos --HG-- branch : patches-from-atys --- code/ryzom/client/src/entity_cl.cpp | 4 +++ .../src/interface_v3/action_handler_game.cpp | 1 + .../src/interface_v3/interface_manager.cpp | 1 + .../client/src/string_manager_client.cpp | 27 ++++++++++++------- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/code/ryzom/client/src/entity_cl.cpp b/code/ryzom/client/src/entity_cl.cpp index 88669ce68..5231b274d 100644 --- a/code/ryzom/client/src/entity_cl.cpp +++ b/code/ryzom/client/src/entity_cl.cpp @@ -2327,6 +2327,10 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) _HasReservedTitle = true; } } + else + { + _EntityName = STRING_MANAGER::CStringManagerClient::getLocalizedName(_EntityName); + } } // Is the first title or a new title ? diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 2f91cb9a5..160fc805c 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2066,6 +2066,7 @@ class CActionHandlerSetTargetName : public IActionHandler } // Set to target CInterfaceExprValue evUCStr; + TargetName = STRING_MANAGER::CStringManagerClient::getLocalizedName(TargetName); evUCStr.setUCString(TargetName); CInterfaceLink::setTargetProperty(sNameTarget, evUCStr); evUCStr.setUCString(TargetTitle); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 5593a365f..16377ac94 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2356,6 +2356,7 @@ void CInterfaceManager::processServerIDString() if (bValid) { + ucstrToAffect = STRING_MANAGER::CStringManagerClient::getLocalizedName(ucstrToAffect); val.setUCString (ucstrToAffect); CInterfaceLink::setTargetProperty (pISW->Target, val); } diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index a8b2cf058..88bebdfe7 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -716,6 +716,12 @@ restartLoop: if (!getString(param.StringId, str)) 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(!str.empty() && !PlayerSelectedHomeShardNameWithParenthesis.empty()) { @@ -1623,24 +1629,27 @@ const ucchar *CStringManagerClient::getTitleLocalizedName(const ucstring &titleI return getLocalizedName(titleId); } -const ucchar *CStringManagerClient::getLocalizedName(const ucstring &text) + +const ucchar *CStringManagerClient::getLocalizedName(const ucstring &uctext) { + string text = uctext.toUtf8(); if (text[0] == '[') { - vector textLocalizations; - ucstring defaultText = ucstring(""); - splitUCString(text.substr(1), ucstring("["), textLocalizations); + vector textLocalizations; + static ucstring defaultText; + splitString(text.substr(1), "[", textLocalizations); if (!textLocalizations.empty()) { for(uint i = 0; i