diff --git a/source/glest_game/global/lang.cpp b/source/glest_game/global/lang.cpp index e4dca29b..c5d3fe21 100644 --- a/source/glest_game/global/lang.cpp +++ b/source/glest_game/global/lang.cpp @@ -260,9 +260,11 @@ void Lang::loadTechTreeStrings(string techTree) { string techTreeFolder = currentPath + techTree + "/"; 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(); + techTreeStringsDefault.clear(); //try to load the current language first if(fileExists(path)) { @@ -279,6 +281,10 @@ void Lang::loadTechTreeStrings(string techTree) { techTreeStrings.load(path); } } + + if(fileExists(pathDefault)) { + techTreeStringsDefault.load(pathDefault); + } } 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 = ""; 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) { result = defaultValue; diff --git a/source/glest_game/global/lang.h b/source/glest_game/global/lang.h index 4f651de6..da0a489d 100644 --- a/source/glest_game/global/lang.h +++ b/source/glest_game/global/lang.h @@ -38,6 +38,7 @@ private: Properties strings; Properties scenarioStrings; Properties techTreeStrings; + Properties techTreeStringsDefault; std::map otherLanguageStrings;