mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
Throw out more error string concating
This commit is contained in:
@ -443,7 +443,6 @@ class LocalizationDatabase
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::string fDirectory; // the directory we're supposed to parse
|
std::string fDirectory; // the directory we're supposed to parse
|
||||||
std::wstring fErrorString; // total sum of all errors encountered (also has warnings and status messages)
|
|
||||||
|
|
||||||
std::vector<LocalizationXMLFile> fFiles; // the various XML files in that directory
|
std::vector<LocalizationXMLFile> fFiles; // the various XML files in that directory
|
||||||
|
|
||||||
@ -463,8 +462,6 @@ public:
|
|||||||
LocalizationDatabase() {}
|
LocalizationDatabase() {}
|
||||||
|
|
||||||
void Parse(const std::string & directory);
|
void Parse(const std::string & directory);
|
||||||
void ResetOutput() {fErrorString = L"";}
|
|
||||||
std::wstring GetOutput() {return fErrorString;}
|
|
||||||
|
|
||||||
LocalizationXMLFile::ageMap GetData() {return fData;}
|
LocalizationXMLFile::ageMap GetData() {return fData;}
|
||||||
};
|
};
|
||||||
@ -482,7 +479,10 @@ LocalizationXMLFile::element LocalizationDatabase::IMergeElementData(Localizatio
|
|||||||
for (curTranslation = secondElement.begin(); curTranslation != secondElement.end(); curTranslation++)
|
for (curTranslation = secondElement.begin(); curTranslation != secondElement.end(); curTranslation++)
|
||||||
{
|
{
|
||||||
if (firstElement.find(curTranslation->first) != firstElement.end())
|
if (firstElement.find(curTranslation->first) != firstElement.end())
|
||||||
fErrorString += L"Duplicate " + curTranslation->first + L" translation for " + path + L" found in file " + fileName + L" Ignoring second translation\n";
|
{
|
||||||
|
pfLocalizationDataMgr::GetLog()->AddLineF("Duplicate %S translation for %S found in file %S Ignoring second translation",
|
||||||
|
curTranslation->first.c_str(), path.c_str(), fileName.c_str());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
firstElement[curTranslation->first] = curTranslation->second;
|
firstElement[curTranslation->first] = curTranslation->second;
|
||||||
}
|
}
|
||||||
@ -586,8 +586,8 @@ void LocalizationDatabase::IVerifyElement(const std::wstring &ageName, const std
|
|||||||
|
|
||||||
if (!languageExists)
|
if (!languageExists)
|
||||||
{
|
{
|
||||||
fErrorString += L"ERROR: The language " + curTranslation->first + L" used by " + ageName + L"." + setName + L".";
|
pfLocalizationDataMgr::GetLog()->AddLineF("ERROR: The language %S used by %S.%S.%S is not supported, discarding translation",
|
||||||
fErrorString += elementName + L" is not supported, discarding translation\n";
|
curTranslation->first.c_str(), ageName.c_str(), setName.c_str(), elementName.c_str());
|
||||||
curTranslation = theElement.erase(curTranslation);
|
curTranslation = theElement.erase(curTranslation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -598,8 +598,8 @@ void LocalizationDatabase::IVerifyElement(const std::wstring &ageName, const std
|
|||||||
{
|
{
|
||||||
if (theElement.find(languageNames[i]) == theElement.end())
|
if (theElement.find(languageNames[i]) == theElement.end())
|
||||||
{
|
{
|
||||||
fErrorString += L"WARNING: Language " + languageNames[i] + L" is missing from the translations in element ";
|
pfLocalizationDataMgr::GetLog()->AddLineF("WARNING: Language %S is missing from the translations in element %S.%S.%S, you'll want to get translations for that!",
|
||||||
fErrorString += ageName + L"." + setName + L"." + elementName + L", you'll want to get translations for that!\n";
|
languageNames[i].c_str(), ageName.c_str(), setName.c_str(), elementName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -619,8 +619,8 @@ void LocalizationDatabase::IVerifySet(const std::wstring &ageName, const std::ws
|
|||||||
// Check that we at least have a default language translation for fallback
|
// Check that we at least have a default language translation for fallback
|
||||||
if (curElement->second.find(defaultLanguage) == curElement->second.end())
|
if (curElement->second.find(defaultLanguage) == curElement->second.end())
|
||||||
{
|
{
|
||||||
fErrorString += L"ERROR: Default language " + defaultLanguage + L" is missing from the translations in element ";
|
pfLocalizationDataMgr::GetLog()->AddLineF("ERROR: Default language %S is missing from the translations in element %S.%S.%S, deleting element",
|
||||||
fErrorString += ageName + L"." + setName + L"." + curElement->first + L", deleting element\n";
|
defaultLanguage.c_str(), ageName.c_str(), setName.c_str(), curElement->first.c_str());
|
||||||
curElement = theSet.erase(curElement);
|
curElement = theSet.erase(curElement);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -656,7 +656,6 @@ void LocalizationDatabase::Parse(const std::string & directory)
|
|||||||
{
|
{
|
||||||
fDirectory = directory;
|
fDirectory = directory;
|
||||||
fFiles.clear();
|
fFiles.clear();
|
||||||
fErrorString = L"";
|
|
||||||
|
|
||||||
char filename[255];
|
char filename[255];
|
||||||
hsFolderIterator xmlFolder((directory+PATH_SEPARATOR_STR).c_str());
|
hsFolderIterator xmlFolder((directory+PATH_SEPARATOR_STR).c_str());
|
||||||
@ -664,18 +663,13 @@ void LocalizationDatabase::Parse(const std::string & directory)
|
|||||||
{
|
{
|
||||||
xmlFolder.GetPathAndName(filename);
|
xmlFolder.GetPathAndName(filename);
|
||||||
|
|
||||||
wchar_t *buff = hsStringToWString(filename);
|
|
||||||
std::wstring wFilename = buff;
|
|
||||||
delete [] buff;
|
|
||||||
|
|
||||||
LocalizationXMLFile newFile;
|
LocalizationXMLFile newFile;
|
||||||
bool retVal = newFile.Parse(filename);
|
bool retVal = newFile.Parse(filename);
|
||||||
if (!retVal)
|
if (!retVal)
|
||||||
fErrorString += L"WARNING: Errors in file " + wFilename;
|
pfLocalizationDataMgr::GetLog()->AddLineF("WARNING: Errors in file %s", filename);
|
||||||
|
|
||||||
fFiles.push_back(newFile);
|
fFiles.push_back(newFile);
|
||||||
|
pfLocalizationDataMgr::GetLog()->AddLineF("File %s parsed and added to database", filename);
|
||||||
fErrorString += L"File " + wFilename + L" parsed and added to database\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IMergeData();
|
IMergeData();
|
||||||
@ -929,12 +923,7 @@ void pfLocalizationDataMgr::IConvertElement(LocElementInfo *elementInfo, const s
|
|||||||
if (numArgs == -1) // just started
|
if (numArgs == -1) // just started
|
||||||
numArgs = argCount;
|
numArgs = argCount;
|
||||||
else if (argCount != numArgs)
|
else if (argCount != numArgs)
|
||||||
{
|
fLog->AddLineF("WARNING: Argument number mismatch in element %S for %S", curPath.c_str(), curTranslation->first.c_str());
|
||||||
std::wstring errorStr = L"WARNING: Argument number mismatch in element " + curPath + L" for " + curTranslation->first;
|
|
||||||
char* cErrorStr = hsWStringToString(errorStr.c_str());
|
|
||||||
fLog->AddLine(cErrorStr);
|
|
||||||
delete [] cErrorStr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fLocalizedElements[curPath] = newElement;
|
fLocalizedElements[curPath] = newElement;
|
||||||
@ -1093,10 +1082,6 @@ void pfLocalizationDataMgr::SetupData()
|
|||||||
fDatabase = new LocalizationDatabase();
|
fDatabase = new LocalizationDatabase();
|
||||||
fDatabase->Parse(fDataPath);
|
fDatabase->Parse(fDataPath);
|
||||||
|
|
||||||
char *temp = hsWStringToString(fDatabase->GetOutput().c_str());
|
|
||||||
fLog->AddLine(temp);
|
|
||||||
delete [] temp;
|
|
||||||
|
|
||||||
fLog->AddLine("File reading complete, converting to native data format");
|
fLog->AddLine("File reading complete, converting to native data format");
|
||||||
|
|
||||||
// and now we read all the data out of the database and convert it to our native formats
|
// and now we read all the data out of the database and convert it to our native formats
|
||||||
@ -1165,7 +1150,7 @@ WStringVector pfLocalizationDataMgr::GetLanguages(const std::wstring & ageName,
|
|||||||
for (curLanguage = elem.begin(); curLanguage != elem.end(); curLanguage++)
|
for (curLanguage = elem.begin(); curLanguage != elem.end(); curLanguage++)
|
||||||
{
|
{
|
||||||
std::wstring language = curLanguage->first;
|
std::wstring language = curLanguage->first;
|
||||||
if (language != L"") // somehow blank language names sneak in... so don't return them
|
if (!language.empty()) // somehow blank language names sneak in... so don't return them
|
||||||
retVal.push_back(curLanguage->first);
|
retVal.push_back(curLanguage->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user