- added a default translation file for techtrees, <techtreename>_default.lng
This commit is contained in:
parent
2267011cbc
commit
0120c5211a
|
@ -260,9 +260,11 @@ void Lang::loadTechTreeStrings(string techTree) {
|
||||||
|
|
||||||
string techTreeFolder = currentPath + techTree + "/";
|
string techTreeFolder = currentPath + techTree + "/";
|
||||||
string path = techTreeFolder + "lang/" + techTree + "_" + language + ".lng";
|
string path = techTreeFolder + "lang/" + techTree + "_" + language + ".lng";
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
|
string pathDefault = techTreeFolder + "lang/" + techTree + "_default.lng";
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s] pathDefault = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),pathDefault.c_str());
|
||||||
|
|
||||||
techTreeStrings.clear();
|
techTreeStrings.clear();
|
||||||
|
techTreeStringsDefault.clear();
|
||||||
|
|
||||||
//try to load the current language first
|
//try to load the current language first
|
||||||
if(fileExists(path)) {
|
if(fileExists(path)) {
|
||||||
|
@ -279,6 +281,10 @@ void Lang::loadTechTreeStrings(string techTree) {
|
||||||
techTreeStrings.load(path);
|
techTreeStrings.load(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(fileExists(pathDefault)) {
|
||||||
|
techTreeStringsDefault.load(pathDefault);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lang::hasString(const string &s, string uselanguage, bool fallbackToDefault) {
|
bool Lang::hasString(const string &s, string uselanguage, bool fallbackToDefault) {
|
||||||
|
@ -381,7 +387,15 @@ string Lang::getTechTreeString(const string &s,const char *defaultValue) {
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
if(techTreeStrings.hasString(s) == true || defaultValue == NULL) {
|
if(techTreeStrings.hasString(s) == true || defaultValue == NULL) {
|
||||||
result = techTreeStrings.getString(s);
|
if(techTreeStrings.hasString(s) == false && techTreeStringsDefault.hasString(s) == true) {
|
||||||
|
result = techTreeStringsDefault.getString(s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = techTreeStrings.getString(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(techTreeStringsDefault.hasString(s) == true) {
|
||||||
|
result = techTreeStringsDefault.getString(s);
|
||||||
}
|
}
|
||||||
else if(defaultValue != NULL) {
|
else if(defaultValue != NULL) {
|
||||||
result = defaultValue;
|
result = defaultValue;
|
||||||
|
|
|
@ -38,6 +38,7 @@ private:
|
||||||
Properties strings;
|
Properties strings;
|
||||||
Properties scenarioStrings;
|
Properties scenarioStrings;
|
||||||
Properties techTreeStrings;
|
Properties techTreeStrings;
|
||||||
|
Properties techTreeStringsDefault;
|
||||||
|
|
||||||
std::map<string,Properties> otherLanguageStrings;
|
std::map<string,Properties> otherLanguageStrings;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue