[RLVa] rlva_strings update.
rlva strings floater coming soon! I highly doubt the translations work anymore If they still can be translated, I leave it up to translators to decide if they should be Contact me if you need translation code improved here.
This commit is contained in:
@@ -157,44 +157,31 @@ bool RlvSettings::onChangedSettingBOOL(const LLSD& sdValue, bool* pfSetting)
|
||||
//
|
||||
|
||||
std::vector<std::string> RlvStrings::m_Anonyms;
|
||||
std::map<std::string, std::string> RlvStrings::m_StringMap;
|
||||
RlvStrings::string_map_t RlvStrings::m_StringMap;
|
||||
std::string RlvStrings::m_StringMapPath;
|
||||
|
||||
// Checked: 2010-03-09 (RLVa-1.2.0a) | Added: RLVa-1.1.0h
|
||||
// Checked: 2011-11-08 (RLVa-1.5.0)
|
||||
void RlvStrings::initClass()
|
||||
{
|
||||
static bool fInitialized = false;
|
||||
if (!fInitialized)
|
||||
{
|
||||
LLXMLNodePtr xmlRoot;
|
||||
if ( (!LLUICtrlFactory::getLayeredXMLNode("rlva_strings.xml", xmlRoot)) || (xmlRoot.isNull()) || (!xmlRoot->hasName("rlva_strings")) )
|
||||
// Load the default string values
|
||||
std::string* itFile = &gDirUtilp->findSkinnedFilename(LLUICtrlFactory::getXUIPaths().front(), RLV_STRINGS_FILE);
|
||||
/*
|
||||
std::vector<std::string> files = gDirUtilp->findSkinnedFilenames(LLDir::XUI, RLV_STRINGS_FILE, LLDir::ALL_SKINS);
|
||||
m_StringMapPath = (!files.empty()) ? files.front() : LLStringUtil::null;
|
||||
for (auto itFile = files.cbegin(); itFile != files.cend(); ++itFile)
|
||||
*/
|
||||
if (!itFile->empty())
|
||||
{
|
||||
RLV_ERRS << "Problem reading RLVa string XML file" << RLV_ENDL;
|
||||
return;
|
||||
loadFromFile(*itFile, false);
|
||||
}
|
||||
|
||||
for (LLXMLNode* pNode = xmlRoot->getFirstChild(); pNode != NULL; pNode = pNode->getNextSibling())
|
||||
{
|
||||
if (pNode->hasName("strings"))
|
||||
{
|
||||
std::string strName;
|
||||
for (LLXMLNode* pStringNode = pNode->getFirstChild(); pStringNode != NULL; pStringNode = pStringNode->getNextSibling())
|
||||
{
|
||||
if ( (!pStringNode->hasName("string")) || (!pStringNode->getAttributeString("name", strName)) )
|
||||
continue;
|
||||
m_StringMap[strName] = pStringNode->getTextContents();
|
||||
}
|
||||
}
|
||||
else if (pNode->hasName("anonyms"))
|
||||
{
|
||||
for (LLXMLNode* pAnonymNode = pNode->getFirstChild(); pAnonymNode != NULL; pAnonymNode = pAnonymNode->getNextSibling())
|
||||
{
|
||||
if (!pAnonymNode->hasName("anonym"))
|
||||
continue;
|
||||
m_Anonyms.push_back(pAnonymNode->getTextContents());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Load the custom string overrides
|
||||
loadFromFile(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, RLV_STRINGS_FILE), true);
|
||||
|
||||
// Sanity check
|
||||
if ( (m_StringMap.empty()) || (m_Anonyms.empty()) )
|
||||
{
|
||||
RLV_ERRS << "Problem parsing RLVa string XML file" << RLV_ENDL;
|
||||
@@ -205,6 +192,68 @@ void RlvStrings::initClass()
|
||||
}
|
||||
}
|
||||
|
||||
// Checked: 2011-11-08 (RLVa-1.5.0)
|
||||
void RlvStrings::loadFromFile(const std::string& strFilePath, bool fUserOverride)
|
||||
{
|
||||
llifstream fileStream(strFilePath, std::ios::binary); LLSD sdFileData;
|
||||
if ( (!fileStream.is_open()) || (!LLSDSerialize::fromXMLDocument(sdFileData, fileStream)) )
|
||||
return;
|
||||
fileStream.close();
|
||||
|
||||
if (sdFileData.has("strings"))
|
||||
{
|
||||
const LLSD& sdStrings = sdFileData["strings"];
|
||||
for (LLSD::map_const_iterator itString = sdStrings.beginMap(); itString != sdStrings.endMap(); ++itString)
|
||||
{
|
||||
if ( (!itString->second.has("value")) || ((fUserOverride) && (!hasString(itString->first))) )
|
||||
continue;
|
||||
|
||||
std::list<std::string>& listValues = m_StringMap[itString->first];
|
||||
if (!fUserOverride)
|
||||
{
|
||||
if (listValues.size() > 0)
|
||||
listValues.pop_front();
|
||||
listValues.push_front(itString->second["value"].asString());
|
||||
}
|
||||
else
|
||||
{
|
||||
while (listValues.size() > 1)
|
||||
listValues.pop_back();
|
||||
listValues.push_back(itString->second["value"].asString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sdFileData.has("anonyms"))
|
||||
{
|
||||
const LLSD& sdAnonyms = sdFileData["anonyms"];
|
||||
for (LLSD::array_const_iterator itAnonym = sdAnonyms.beginArray(); itAnonym != sdAnonyms.endArray(); ++itAnonym)
|
||||
{
|
||||
m_Anonyms.push_back((*itAnonym).asString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checked: 2011-11-08 (RLVa-1.5.0)
|
||||
void RlvStrings::saveToFile(const std::string& strFilePath)
|
||||
{
|
||||
LLSD sdFileData;
|
||||
|
||||
LLSD& sdStrings = sdFileData["strings"];
|
||||
for (string_map_t::const_iterator itString = m_StringMap.begin(); itString != m_StringMap.end(); ++itString)
|
||||
{
|
||||
const std::list<std::string>& listValues = itString->second;
|
||||
if (listValues.size() > 1)
|
||||
sdStrings[itString->first]["value"] = listValues.back();
|
||||
}
|
||||
|
||||
llofstream fileStream(strFilePath);
|
||||
if (!fileStream.good())
|
||||
return;
|
||||
|
||||
LLSDSerialize::toPrettyXML(sdFileData, fileStream);
|
||||
fileStream.close();
|
||||
}
|
||||
|
||||
// Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a
|
||||
const std::string& RlvStrings::getAnonym(const std::string& strName)
|
||||
{
|
||||
@@ -217,12 +266,12 @@ const std::string& RlvStrings::getAnonym(const std::string& strName)
|
||||
return m_Anonyms[nHash % m_Anonyms.size()];
|
||||
}
|
||||
|
||||
// Checked: 2009-11-11 (RLVa-1.1.0a) | Added: RLVa-1.1.0a
|
||||
// Checked: 2011-11-08 (RLVa-1.5.0)
|
||||
const std::string& RlvStrings::getString(const std::string& strStringName)
|
||||
{
|
||||
static const std::string strMissing = "(Missing RLVa string)";
|
||||
std::map<std::string, std::string>::const_iterator itString = m_StringMap.find(strStringName);
|
||||
return (itString != m_StringMap.end()) ? itString->second : strMissing;
|
||||
string_map_t::const_iterator itString = m_StringMap.find(strStringName);
|
||||
return (itString != m_StringMap.end()) ? itString->second.back() : strMissing;
|
||||
}
|
||||
|
||||
// Checked: 2009-11-25 (RLVa-1.1.0f) | Added: RLVa-1.1.0f
|
||||
@@ -251,6 +300,8 @@ const char* RlvStrings::getStringFromReturnCode(ERlvCmdRet eRet)
|
||||
return "unknown command";
|
||||
case RLV_RET_FAILED_NOSHAREDROOT:
|
||||
return "missing #RLV";
|
||||
case RLV_RET_DEPRECATED:
|
||||
return "deprecated";
|
||||
// The following are identified by the chat verb
|
||||
case RLV_RET_RETAINED:
|
||||
case RLV_RET_SUCCESS:
|
||||
@@ -283,15 +334,29 @@ std::string RlvStrings::getVersionAbout()
|
||||
}
|
||||
|
||||
// Checked: 2010-03-27 (RLVa-1.4.0a) | Modified: RLVa-1.1.0a
|
||||
std::string RlvStrings::getVersionNum()
|
||||
std::string RlvStrings::getVersionNum()
|
||||
{
|
||||
return llformat("%d%02d%02d%02d", RLV_VERSION_MAJOR, RLV_VERSION_MINOR, RLV_VERSION_PATCH, RLV_VERSION_BUILD);
|
||||
}
|
||||
|
||||
// Checked: 2010-05-26 (RLVa-1.2.0h) | Added: RLVa-1.2.0g
|
||||
bool RlvStrings::hasString(const std::string& strStringName)
|
||||
// Checked: 2011-11-08 (RLVa-1.5.0)
|
||||
bool RlvStrings::hasString(const std::string& strStringName, bool fCheckCustom)
|
||||
{
|
||||
return m_StringMap.find(strStringName) != m_StringMap.end();
|
||||
string_map_t::const_iterator itString = m_StringMap.find(strStringName);
|
||||
return (itString != m_StringMap.end()) && ((!fCheckCustom) || (itString->second.size() > 0));
|
||||
}
|
||||
|
||||
// Checked: 2011-11-08 (RLVa-1.5.0)
|
||||
void RlvStrings::setCustomString(const std::string& strStringName, const std::string& strStringValue)
|
||||
{
|
||||
if (!hasString(strStringName))
|
||||
return;
|
||||
|
||||
std::list<std::string>& listValues = m_StringMap[strStringName];
|
||||
while (listValues.size() > 1)
|
||||
listValues.pop_back();
|
||||
if (!strStringValue.empty())
|
||||
listValues.push_back(strStringValue);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -128,20 +128,25 @@ class RlvStrings
|
||||
{
|
||||
public:
|
||||
static void initClass();
|
||||
static void loadFromFile(const std::string& strFilePath, bool fDefault);
|
||||
static void saveToFile(const std::string& strFilePath);
|
||||
|
||||
static const std::string& getAnonym(const LLAvatarName& avName); // @shownames
|
||||
static const std::string& getAnonym(const std::string& strName); // @shownames
|
||||
static const std::string& getBehaviourNotificationString(ERlvBehaviour eBhvr, ERlvParamType eType);
|
||||
static const std::string& getString(const std::string& strStringName);
|
||||
static const char* getStringFromReturnCode(ERlvCmdRet eRet);
|
||||
static const std::string& getStringMapPath() { return m_StringMapPath; }
|
||||
static std::string getVersion(bool fLegacy = false); // @version
|
||||
static std::string getVersionAbout(); // Shown in Help / About
|
||||
static std::string getVersionNum(); // @versionnum
|
||||
static bool hasString(const std::string& strStringName);
|
||||
static bool hasString(const std::string& strStringName, bool fCheckCustom = false);
|
||||
static void setCustomString(const std::string& strStringName, const std::string& strStringValue);
|
||||
|
||||
protected:
|
||||
static std::vector<std::string> m_Anonyms;
|
||||
static std::map<std::string, std::string> m_StringMap;
|
||||
typedef std::map<std::string, std::list<std::string> > string_map_t;
|
||||
static string_map_t m_StringMap;
|
||||
static std::string m_StringMapPath;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -102,6 +102,7 @@ const S32 RLVa_VERSION_BUILD = 0;
|
||||
#define RLV_CMD_PREFIX '@'
|
||||
#define RLV_PUTINV_PREFIX "#RLV/~"
|
||||
#define RLV_SETROT_OFFSET F_PI_BY_TWO // @setrot is off by 90<39> with the rest of SL
|
||||
#define RLV_STRINGS_FILE "rlva_strings.xml"
|
||||
|
||||
#define RLV_FOLDER_FLAG_NOSTRIP "nostrip"
|
||||
#define RLV_FOLDER_PREFIX_HIDDEN '.'
|
||||
|
||||
@@ -1,77 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<rlva_strings>
|
||||
<llsd>
|
||||
<map>
|
||||
|
||||
<strings>
|
||||
<!-- Primarily used when @showloc restricted -->
|
||||
<string name="hidden_generic">(Hidden)</string>
|
||||
<string name="hidden_parcel">(Hidden parcel)</string>
|
||||
<string name="hidden_region">(Hidden region)</string>
|
||||
<key>strings</key>
|
||||
<map>
|
||||
<!-- Primarily used when @showloc restricted -->
|
||||
<key>hidden_generic</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>(Hidden)</string>
|
||||
</map>
|
||||
<key>hidden_parcel</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>(Hidden parcel)</string>
|
||||
</map>
|
||||
<key>hidden_region</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>(Hidden region)</string>
|
||||
</map>
|
||||
|
||||
<!-- Received/sent IMs will be replaced by the matching string when @recvim/sendim restricted -->
|
||||
<string name="blocked_recvim">*** IM blocked by your viewer</string>
|
||||
<string name="blocked_sendim">*** IM blocked by sender's viewer</string>
|
||||
<!-- Received/sent IMs will be replaced by the matching string when @recvim/sendim restricted -->
|
||||
<key>blocked_recvim</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>*** IM blocked by your viewer</string>
|
||||
<key>description</key>
|
||||
<string>Shown in place of the original message when an incoming IM is blocked</string>
|
||||
<key>label</key>
|
||||
<string>Blocked incoming IM message (local)</string>
|
||||
<key>customizable</key>
|
||||
<boolean>1</boolean>
|
||||
</map>
|
||||
<key>blocked_sendim</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>*** IM blocked by sender's viewer</string>
|
||||
<key>description</key>
|
||||
<string>Shown (and sent to the remote party) when an outgoing IM is blocked</string>
|
||||
<key>label</key>
|
||||
<string>Blocked outgoing IM message (local + remote)</string>
|
||||
<key>customizable</key>
|
||||
<boolean>1</boolean>
|
||||
</map>
|
||||
|
||||
<!-- Shown as notifications -->
|
||||
<string name="blocked_generic">Unable to perform action due to RLV restrictions</string>
|
||||
<string name="blocked_permattach">Attempt to attach '[OBJECT]' was denied due to RLV restrictions</string>
|
||||
<string name="blocked_startim">Unable to start IM session with [RECIPIENT] due to RLV restrictions</string>
|
||||
<string name="blocked_startconf">Unable to start conference due to RLV restrictions</string>
|
||||
<string name="blocked_teleport">Unable to initiate teleport due to RLV restrictions</string>
|
||||
<string name="blocked_viewxxx">Unable to open [TYPE] due to RLV restrictions</string>
|
||||
<!-- Shown as notifications -->
|
||||
<key>blocked_generic</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>Unable to perform action due to RLV restrictions</string>
|
||||
</map>
|
||||
<key>blocked_permattach</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>Attempt to attach '[OBJECT]' was denied due to RLV restrictions</string>
|
||||
</map>
|
||||
<key>blocked_permteleport</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>[OBJECT]' was denied permission to teleport you due to RLV restrictions</string>
|
||||
</map>
|
||||
<key>blocked_startim</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>Unable to start IM session with [RECIPIENT] due to RLV restrictions</string>
|
||||
</map>
|
||||
<key>blocked_startconf</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>Unable to start conference with [RECIPIENT] due to RLV restrictions</string>
|
||||
</map>
|
||||
<key>blocked_teleport</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>Unable to initiate teleport due to RLV restrictions</string>
|
||||
</map>
|
||||
<key>blocked_viewxxx</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>Unable to open [TYPE] due to RLV restrictions</string>
|
||||
</map>
|
||||
<key>blocked_wireframe</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>Unable to enable wireframe mode due to RLV restrictions</string>
|
||||
</map>
|
||||
|
||||
<!-- Sent as "Busy" messages to the remote party -->
|
||||
<string name="blocked_recvim_remote">
|
||||
The Resident you messaged is prevented from reading your instant messages at the moment, please try again later.
|
||||
</string>
|
||||
<string name="blocked_tplure_remote">
|
||||
The Resident you invited is prevented from accepting teleport offers. Please try again later.
|
||||
</string>
|
||||
<!-- Sent as "Busy" messages to the remote party -->
|
||||
<key>blocked_recvim_remote</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>The Resident you messaged is currently prevented from reading your instant messages at the moment, please try again later.</string>
|
||||
<key>description</key>
|
||||
<string>Sent to the remote party when their IM was blocked</string>
|
||||
<key>label</key>
|
||||
<string>Blocked incoming IM message (remote)</string>
|
||||
<key>customizable</key>
|
||||
<boolean>1</boolean>
|
||||
</map>
|
||||
<key>blocked_tplurerequest_remote</key>
|
||||
<map>
|
||||
<key>value</key>
|
||||
<string>The Resident is currently prevented from accepting. Please try again later.</string>
|
||||
<key>description</key>
|
||||
<string>Sent to the remote party when their teleport offer or request was blocked</string>
|
||||
<key>label</key>
|
||||
<string>Blocked teleport offer/request (remote)</string>
|
||||
<key>customizable</key>
|
||||
<boolean>1</boolean>
|
||||
</map>
|
||||
</map>
|
||||
|
||||
<!-- Shown in local chat when dropping inventory onto a nearby agent (moved to strings.xml since it needs to be accesible by LLTrans) -->
|
||||
<!--
|
||||
<string name="inventory_item_offered_rlv">
|
||||
Inventory item offered to [NAME]
|
||||
</string>
|
||||
-->
|
||||
</strings>
|
||||
<!-- Generic names used to replace resident names when @shownames restricted -->
|
||||
<key>anonyms</key>
|
||||
<array>
|
||||
<string>A resident</string>
|
||||
<string>This resident</string>
|
||||
<string>That resident</string>
|
||||
<string>An individual</string>
|
||||
<string>This individual</string>
|
||||
<string>That individual</string>
|
||||
<string>A person</string>
|
||||
<string>This person</string>
|
||||
<string>That person</string>
|
||||
<string>A stranger</string>
|
||||
<string>This stranger</string>
|
||||
<string>That stranger</string>
|
||||
<string>A being</string>
|
||||
<string>This being</string>
|
||||
<string>That being</string>
|
||||
<string>An agent</string>
|
||||
<string>This agent</string>
|
||||
<string>That agent</string>
|
||||
<string>A soul</string>
|
||||
<string>This soul</string>
|
||||
<string>That soul</string>
|
||||
<string>Somebody</string>
|
||||
<string>Some people</string>
|
||||
<string>Someone</string>
|
||||
<string>Mysterious one</string>
|
||||
<string>An unknown being</string>
|
||||
<string>Unidentified one</string>
|
||||
<string>An unknown person</string>
|
||||
</array>
|
||||
|
||||
<!-- Generic names used to replace resident names when @shownames restricted -->
|
||||
<anonyms>
|
||||
<anonym>A resident</anonym>
|
||||
<anonym>This resident</anonym>
|
||||
<anonym>That resident</anonym>
|
||||
<anonym>An individual</anonym>
|
||||
<anonym>This individual</anonym>
|
||||
<anonym>That individual</anonym>
|
||||
<anonym>A person</anonym>
|
||||
<anonym>This person</anonym>
|
||||
<anonym>That person</anonym>
|
||||
<anonym>A stranger</anonym>
|
||||
<anonym>This stranger</anonym>
|
||||
<anonym>That stranger</anonym>
|
||||
<anonym>A being</anonym>
|
||||
<anonym>This being</anonym>
|
||||
<anonym>That being</anonym>
|
||||
<anonym>An agent</anonym>
|
||||
<anonym>This agent</anonym>
|
||||
<anonym>That agent</anonym>
|
||||
<anonym>A soul</anonym>
|
||||
<anonym>This soul</anonym>
|
||||
<anonym>That soul</anonym>
|
||||
<anonym>Somebody</anonym>
|
||||
<anonym>Some people</anonym>
|
||||
<anonym>Someone</anonym>
|
||||
<anonym>Mysterious one</anonym>
|
||||
<anonym>An unknown being</anonym>
|
||||
<anonym>Unidentified one</anonym>
|
||||
<anonym>An unknown person</anonym>
|
||||
</anonyms>
|
||||
|
||||
<behaviour-notifications>
|
||||
<!--
|
||||
<notification behaviour="defaultwear" type="add">Text goes here</notification>
|
||||
<notification behaviour="defaultwear" type="rem">Text goes here</notification>
|
||||
-->
|
||||
</behaviour-notifications>
|
||||
|
||||
</rlva_strings>
|
||||
</map>
|
||||
</llsd>
|
||||
|
||||
Reference in New Issue
Block a user