Changeset 10624 for code/trunk/src/libraries/core/Language.cc
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (10 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/libraries/core/Language.cc
r8858 r10624 37 37 #include "util/Output.h" 38 38 #include "util/StringUtils.h" 39 #include "Core.h" 40 #include "PathConfig.h" 39 #include "ConfigurablePaths.h" 41 40 42 41 namespace orxonox … … 203 202 orxout(internal_info, context::language) << "Read default language file." << endl; 204 203 205 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);204 const std::string& filepath = ConfigurablePaths::getConfigPathString() + getFilename(this->defaultLanguage_); 206 205 207 206 // This creates the file if it's not existing … … 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().getLanguage() << ")." << endl; 253 254 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().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 = ConfigurablePaths::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().getLanguage()) << " to read the translated language entries!" << endl; 264 Core::getInstance().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().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 … … 306 305 orxout(verbose, context::language) << "Write default language file." << endl; 307 306 308 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);307 const std::string& filepath = ConfigurablePaths::getConfigPathString() + getFilename(this->defaultLanguage_); 309 308 310 309 // Open the file
Note: See TracChangeset
for help on using the changeset viewer.