Changeset 6417 for code/trunk/src/libraries/core/Language.cc
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/Language.cc
r5929 r6417 62 62 { 63 63 // Check if the translation is more than just an empty string 64 if ( (localisation != "") && (localisation.size() > 0))64 if (!localisation.empty()) 65 65 { 66 66 this->localisedEntry_ = localisation; … … 130 130 } 131 131 132 COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << "!"<< std::endl;132 COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << '!' << std::endl; 133 133 return it->second; 134 134 } … … 199 199 COUT(4) << "Read default language file." << std::endl; 200 200 201 std::stringfilepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);201 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_); 202 202 203 203 // This creates the file if it's not existing … … 224 224 225 225 // Check if the line is empty 226 if ( (lineString != "") && (lineString.size() > 0))226 if (!lineString.empty()) 227 227 { 228 228 size_t pos = lineString.find('='); … … 246 246 void Language::readTranslatedLanguageFile() 247 247 { 248 COUT(4) << "Read translated language file (" << Core::get Language() << ")." << std::endl;249 250 std::string filepath = PathConfig::getConfigPathString() + getFilename(Core::getLanguage());248 COUT(4) << "Read translated language file (" << Core::getInstance().getLanguage() << ")." << std::endl; 249 250 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getLanguage()); 251 251 252 252 // Open the file … … 257 257 { 258 258 COUT(1) << "An error occurred in Language.cc:" << std::endl; 259 COUT(1) << "Error: Couldn't open file " << getFilename(Core::get Language()) << " to read the translated language entries!" << std::endl;260 Core:: resetLanguage();261 COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << "."<< std::endl;259 COUT(1) << "Error: Couldn't open file " << getFilename(Core::getInstance().getLanguage()) << " to read the translated language entries!" << std::endl; 260 Core::getInstance().resetLanguage(); 261 COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << '.' << std::endl; 262 262 return; 263 263 } … … 270 270 271 271 // Check if the line is empty 272 if ( (lineString != "") && (lineString.size() > 0))272 if (!lineString.empty()) 273 273 { 274 274 size_t pos = lineString.find('='); … … 287 287 else 288 288 { 289 COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFilename(Core::get Language()) << std::endl;289 COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFilename(Core::getInstance().getLanguage()) << std::endl; 290 290 } 291 291 } … … 302 302 COUT(4) << "Language: Write default language file." << std::endl; 303 303 304 std::stringfilepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);304 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_); 305 305 306 306 // Open the file … … 318 318 for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it) 319 319 { 320 file << (*it).second->getLabel() << "=" << (*it).second->getDefault() << std::endl;320 file << it->second->getLabel() << '=' << it->second->getDefault() << std::endl; 321 321 } 322 322
Note: See TracChangeset
for help on using the changeset viewer.