Changeset 10480 for code/branches/core7
- Timestamp:
- May 25, 2015, 9:01:33 PM (10 years ago)
- Location:
- code/branches/core7/src/libraries/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/Core.cc
r10479 r10480 182 182 orxout(internal_info) << "configuring Core" << endl; 183 183 this->config_ = new CoreConfig(); 184 this->config_->setConfigValues(); // TODO: move this into CoreConfig constructor (but resolve dependency to Language)185 184 186 185 // Set the correct log path and rewrite the log file with the correct log levels -
code/branches/core7/src/libraries/core/CoreConfig.cc
r10479 r10480 47 47 { 48 48 RegisterObject(CoreConfig); 49 this->setConfigValues(); 49 50 } 50 51 … … 114 115 { 115 116 // Read the translation file after the language was configured 116 Language::getInstance().readTranslatedLanguageFile(); 117 bool success = Language::getInstance().readTranslatedLanguageFile(this->language_); 118 if (!success) 119 { 120 // Set the language in the config-file back to the default. 121 ResetConfigValue(language_); 122 orxout(internal_info, context::language) << "Reset language to " << this->language_ << '.' << endl; 123 } 117 124 } 118 125 … … 126 133 bInitialized = true; 127 134 } 128 }129 130 //! Sets the language in the config-file back to the default.131 void CoreConfig::resetLanguage()132 {133 ResetConfigValue(language_);134 135 } 135 136 -
code/branches/core7/src/libraries/core/CoreConfig.h
r10479 r10480 47 47 { return this->bDevMode_; } 48 48 49 //! Returns the configured language.50 const std::string& getLanguage()51 { return this->language_; }52 void resetLanguage();53 54 49 inline bool getStartIOConsole() const 55 50 { return this->bStartIOConsole_; } -
code/branches/core7/src/libraries/core/Language.cc
r10479 r10480 37 37 #include "util/Output.h" 38 38 #include "util/StringUtils.h" 39 #include "Core.h"40 39 #include "PathConfig.h" 41 40 … … 247 246 /** 248 247 @brief Reads the language file of the configured language and assigns the localisation to the corresponding LanguageEntry object. 249 */ 250 void Language::readTranslatedLanguageFile() 251 { 252 orxout(internal_info, context::language) << "Read translated language file (" << Core::getInstance().getConfig()->getLanguage() << ")." << endl; 253 254 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getConfig()->getLanguage()); 248 @return Returns false if the language file couldn't be found. 249 */ 250 bool Language::readTranslatedLanguageFile(const std::string& language) 251 { 252 orxout(internal_info, context::language) << "Read translated language file (" << language << ")." << endl; 253 254 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(language); 255 255 256 256 // Open the file … … 261 261 { 262 262 orxout(internal_error, context::language) << "An error occurred in Language.cc:" << endl; 263 orxout(internal_error, context::language) << "Couldn't open file " << getFilename(Core::getInstance().getConfig()->getLanguage()) << " to read the translated language entries!" << endl; 264 Core::getInstance().getConfig()->resetLanguage(); 265 orxout(internal_info, context::language) << "Reset language to " << this->defaultLanguage_ << '.' << endl; 266 return; 263 orxout(internal_error, context::language) << "Couldn't open file " << getFilename(language) << " to read the translated language entries!" << endl; 264 return false; 267 265 } 268 266 … … 291 289 else 292 290 { 293 orxout(internal_warning, context::language) << "Invalid language entry \"" << lineString << "\" in " << getFilename( Core::getInstance().getConfig()->getLanguage()) << endl;291 orxout(internal_warning, context::language) << "Invalid language entry \"" << lineString << "\" in " << getFilename(language) << endl; 294 292 } 295 293 } … … 297 295 298 296 file.close(); 297 return true; 299 298 } 300 299 -
code/branches/core7/src/libraries/core/Language.h
r10479 r10480 174 174 175 175 void readDefaultLanguageFile(); 176 void readTranslatedLanguageFile();176 bool readTranslatedLanguageFile(const std::string& language); 177 177 void writeDefaultLanguageFile() const; 178 178 static std::string getFilename(const std::string& language);
Note: See TracChangeset
for help on using the changeset viewer.