|
|
@ -554,7 +554,7 @@ void LocalizationDatabase::IMergeData() |
|
|
|
|
|
|
|
|
|
|
|
void LocalizationDatabase::IVerifyElement(const std::wstring &ageName, const std::wstring &setName, LocalizationXMLFile::set::iterator& curElement) |
|
|
|
void LocalizationDatabase::IVerifyElement(const std::wstring &ageName, const std::wstring &setName, LocalizationXMLFile::set::iterator& curElement) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::wstring> languageNames; |
|
|
|
WStringVector languageNames; |
|
|
|
std::wstring defaultLanguage; |
|
|
|
std::wstring defaultLanguage; |
|
|
|
|
|
|
|
|
|
|
|
int numLocales = plLocalization::GetNumLocales(); |
|
|
|
int numLocales = plLocalization::GetNumLocales(); |
|
|
@ -788,9 +788,9 @@ mapT &pfLocalizationDataMgr::pf3PartMap<mapT>::operator[](const std::wstring &ke |
|
|
|
//// getAgeList() ////////////////////////////////////////////////////
|
|
|
|
//// getAgeList() ////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
template<class mapT> |
|
|
|
template<class mapT> |
|
|
|
std::vector<std::wstring> pfLocalizationDataMgr::pf3PartMap<mapT>::getAgeList() |
|
|
|
WStringVector pfLocalizationDataMgr::pf3PartMap<mapT>::getAgeList() |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::wstring> retVal; |
|
|
|
WStringVector retVal; |
|
|
|
typename ThreePartMap::iterator curAge; |
|
|
|
typename ThreePartMap::iterator curAge; |
|
|
|
|
|
|
|
|
|
|
|
for (curAge = fData.begin(); curAge != fData.end(); curAge++) |
|
|
|
for (curAge = fData.begin(); curAge != fData.end(); curAge++) |
|
|
@ -802,9 +802,9 @@ std::vector<std::wstring> pfLocalizationDataMgr::pf3PartMap<mapT>::getAgeList() |
|
|
|
//// getSetList() ////////////////////////////////////////////////////
|
|
|
|
//// getSetList() ////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
template<class mapT> |
|
|
|
template<class mapT> |
|
|
|
std::vector<std::wstring> pfLocalizationDataMgr::pf3PartMap<mapT>::getSetList(const std::wstring & age) |
|
|
|
WStringVector pfLocalizationDataMgr::pf3PartMap<mapT>::getSetList(const std::wstring & age) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::wstring> retVal; |
|
|
|
WStringVector retVal; |
|
|
|
typename std::map<std::wstring, std::map<std::wstring, mapT> >::iterator curSet; |
|
|
|
typename std::map<std::wstring, std::map<std::wstring, mapT> >::iterator curSet; |
|
|
|
|
|
|
|
|
|
|
|
if (fData.find(age) == fData.end()) |
|
|
|
if (fData.find(age) == fData.end()) |
|
|
@ -819,9 +819,9 @@ std::vector<std::wstring> pfLocalizationDataMgr::pf3PartMap<mapT>::getSetList(co |
|
|
|
//// getNameList() ///////////////////////////////////////////////////
|
|
|
|
//// getNameList() ///////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
template<class mapT> |
|
|
|
template<class mapT> |
|
|
|
std::vector<std::wstring> pfLocalizationDataMgr::pf3PartMap<mapT>::getNameList(const std::wstring & age, const std::wstring & set) |
|
|
|
WStringVector pfLocalizationDataMgr::pf3PartMap<mapT>::getNameList(const std::wstring & age, const std::wstring & set) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::wstring> retVal; |
|
|
|
WStringVector retVal; |
|
|
|
typename std::map<std::wstring, mapT>::iterator curName; |
|
|
|
typename std::map<std::wstring, mapT>::iterator curName; |
|
|
|
|
|
|
|
|
|
|
|
if (fData.find(age) == fData.end()) |
|
|
|
if (fData.find(age) == fData.end()) |
|
|
@ -898,10 +898,10 @@ std::wstring pfLocalizationDataMgr::IGetCurrentLanguageName() |
|
|
|
|
|
|
|
|
|
|
|
//// IGetAllLanguageNames ////////////////////////////////////////////
|
|
|
|
//// IGetAllLanguageNames ////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> pfLocalizationDataMgr::IGetAllLanguageNames() |
|
|
|
WStringVector pfLocalizationDataMgr::IGetAllLanguageNames() |
|
|
|
{ |
|
|
|
{ |
|
|
|
int numLocales = plLocalization::GetNumLocales(); |
|
|
|
int numLocales = plLocalization::GetNumLocales(); |
|
|
|
std::vector<std::wstring> retVal; |
|
|
|
WStringVector retVal; |
|
|
|
|
|
|
|
|
|
|
|
for (int curLocale = 0; curLocale <= numLocales; curLocale++) |
|
|
|
for (int curLocale = 0; curLocale <= numLocales; curLocale++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1005,14 +1005,14 @@ void pfLocalizationDataMgr::IWriteText(const std::string & filename, const std:: |
|
|
|
fileData += L"<localizations>\n"; |
|
|
|
fileData += L"<localizations>\n"; |
|
|
|
fileData += L"\t<age name=\"" + ageName + L"\">\n"; |
|
|
|
fileData += L"\t<age name=\"" + ageName + L"\">\n"; |
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> setNames = GetSetList(ageName); |
|
|
|
WStringVector setNames = GetSetList(ageName); |
|
|
|
for (int curSet = 0; curSet < setNames.size(); curSet++) |
|
|
|
for (int curSet = 0; curSet < setNames.size(); curSet++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setEmpty = true; // so far, this set is empty
|
|
|
|
setEmpty = true; // so far, this set is empty
|
|
|
|
std::wstring setCode = L""; |
|
|
|
std::wstring setCode = L""; |
|
|
|
setCode += L"\t\t<set name=\"" + setNames[curSet] + L"\">\n"; |
|
|
|
setCode += L"\t\t<set name=\"" + setNames[curSet] + L"\">\n"; |
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> elementNames = GetElementList(ageName, setNames[curSet]); |
|
|
|
WStringVector elementNames = GetElementList(ageName, setNames[curSet]); |
|
|
|
for (int curElement = 0; curElement < elementNames.size(); curElement++) |
|
|
|
for (int curElement = 0; curElement < elementNames.size(); curElement++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setCode += L"\t\t\t<element name=\"" + elementNames[curElement] + L"\">\n"; |
|
|
|
setCode += L"\t\t\t<element name=\"" + elementNames[curElement] + L"\">\n"; |
|
|
@ -1151,32 +1151,11 @@ pfLocalizedString pfLocalizationDataMgr::GetSpecificElement(const std::wstring & |
|
|
|
return retVal; |
|
|
|
return retVal; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//// GetAgeList //////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> pfLocalizationDataMgr::GetAgeList() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return fLocalizedElements.getAgeList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//// GetSetList //////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> pfLocalizationDataMgr::GetSetList(const std::wstring & ageName) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return fLocalizedElements.getSetList(ageName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//// GetElementList //////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> pfLocalizationDataMgr::GetElementList(const std::wstring & ageName, const std::wstring & setName) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return fLocalizedElements.getNameList(ageName, setName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//// GetLanguages ////////////////////////////////////////////////////
|
|
|
|
//// GetLanguages ////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> pfLocalizationDataMgr::GetLanguages(const std::wstring & ageName, const std::wstring & setName, const std::wstring & elementName) |
|
|
|
WStringVector pfLocalizationDataMgr::GetLanguages(const std::wstring & ageName, const std::wstring & setName, const std::wstring & elementName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::wstring> retVal; |
|
|
|
WStringVector retVal; |
|
|
|
std::wstring key = ageName + L"." + setName + L"." + elementName; |
|
|
|
std::wstring key = ageName + L"." + setName + L"." + elementName; |
|
|
|
if (fLocalizedElements.exists(key)) |
|
|
|
if (fLocalizedElements.exists(key)) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1296,8 +1275,8 @@ bool pfLocalizationDataMgr::DeleteElement(const std::wstring & name) |
|
|
|
void pfLocalizationDataMgr::WriteDatabaseToDisk(const std::string & path) |
|
|
|
void pfLocalizationDataMgr::WriteDatabaseToDisk(const std::string & path) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// first, write the styles and panel settings to styles.sub
|
|
|
|
// first, write the styles and panel settings to styles.sub
|
|
|
|
std::vector<std::wstring> ageNames = GetAgeList(); |
|
|
|
WStringVector ageNames = GetAgeList(); |
|
|
|
std::vector<std::wstring> languageNames = IGetAllLanguageNames(); |
|
|
|
WStringVector languageNames = IGetAllLanguageNames(); |
|
|
|
for (int curAge = 0; curAge < ageNames.size(); curAge++) |
|
|
|
for (int curAge = 0; curAge < ageNames.size(); curAge++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (int curLanguage = 0; curLanguage < languageNames.size(); curLanguage++) |
|
|
|
for (int curLanguage = 0; curLanguage < languageNames.size(); curLanguage++) |
|
|
@ -1319,41 +1298,27 @@ void pfLocalizationDataMgr::WriteDatabaseToDisk(const std::string & path) |
|
|
|
|
|
|
|
|
|
|
|
void pfLocalizationDataMgr::OutputTreeToLog() |
|
|
|
void pfLocalizationDataMgr::OutputTreeToLog() |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::wstring> ages = GetAgeList(); |
|
|
|
WStringVector ages = GetAgeList(); |
|
|
|
|
|
|
|
|
|
|
|
fLog->AddLine("\n"); |
|
|
|
fLog->AddLine("\n"); |
|
|
|
fLog->AddLine("Localization tree:\n"); |
|
|
|
fLog->AddLine("Localization tree:\n"); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ages.size(); i++) |
|
|
|
for (WStringVector::iterator i = ages.begin(); i != ages.end(); ++i) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char *ageName = hsWStringToString(ages[i].c_str()); |
|
|
|
std::wstring age = *i; |
|
|
|
std::string temp = ageName; |
|
|
|
fLog->AddLineF("\t%S", age.c_str()); |
|
|
|
delete [] ageName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
temp = "\t" + temp + "\n"; |
|
|
|
|
|
|
|
fLog->AddLine(temp.c_str()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> sets = GetSetList(ages[i]); |
|
|
|
WStringVector sets = GetSetList(age); |
|
|
|
|
|
|
|
for (WStringVector::iterator j = sets.begin(); j != sets.end(); ++j) |
|
|
|
for (int j = 0; j < sets.size(); j++) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
char *setName = hsWStringToString(sets[j].c_str()); |
|
|
|
std::wstring set = (*j); |
|
|
|
std::string temp = setName; |
|
|
|
fLog->AddLineF("\t\t%S", set.c_str()); |
|
|
|
delete [] setName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
temp = "\t\t" + temp + "\n"; |
|
|
|
|
|
|
|
fLog->AddLine(temp.c_str()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::wstring> names = GetElementList(ages[i], sets[j]); |
|
|
|
WStringVector names = GetElementList(age, set); |
|
|
|
|
|
|
|
for (WStringVector::iterator k = names.begin(); k != names.end(); ++k) |
|
|
|
for (int k = 0; k < names.size(); k++) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
char *elemName = hsWStringToString(names[k].c_str()); |
|
|
|
std::wstring name = (*k); |
|
|
|
std::string temp = elemName; |
|
|
|
fLog->AddLineF("\t\t\t%S", name.c_str()); |
|
|
|
delete [] elemName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
temp = "\t\t\t" + temp + "\n"; |
|
|
|
|
|
|
|
fLog->AddLine(temp.c_str()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|