Changeset 725 for code/branches/FICN/src/orxonox/core/Language.cc
- Timestamp:
- Dec 29, 2007, 11:17:08 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/core/Language.cc
r720 r725 51 51 this->fallbackEntry_ = fallbackEntry; 52 52 this->translatedEntry_ = fallbackEntry; // Set the translation to the fallback entry, for the case that no translation gets assigned 53 this->bTranslationSet_ = false; 53 54 } 54 55 … … 61 62 // Check if the translation is more than just an empty string 62 63 if (translation.compare("") != 0) 64 { 63 65 this->translatedEntry_ = translation; 66 this->bTranslationSet_ = true; 67 } 64 68 else 65 69 this->translatedEntry_ = this->fallbackEntry_; … … 73 77 { 74 78 // If the default entry changes and the translation wasn't set yet, use the new default entry as translation 75 if ( this->translatedEntry_.compare(this->fallbackEntry_) == 0)79 if (!this->bTranslationSet_) 76 80 this->translatedEntry_ = fallbackEntry; 77 81 … … 131 135 @param name The name of the entry 132 136 @param entry The default entry 133 */ 134 void Language::createEntry(const LanguageEntryName& name, const std::string& entry) 135 { 137 @return The created LanguageEntry object 138 */ 139 LanguageEntry* Language::createEntry(const LanguageEntryName& name, const std::string& entry) 140 { 141 std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name); 142 136 143 // Make sure we don't create a duplicate entry 137 if (! this->languageEntries_[name])144 if (!it->second) 138 145 { 139 146 LanguageEntry* newEntry = new LanguageEntry(entry); 140 147 newEntry->setName(name); 141 148 this->languageEntries_[name] = newEntry; 142 }143 else144 { 145 146 }149 return newEntry; 150 } 151 152 COUT(2) << "Warning: Language entry " << name << " is duplicate in " << getFileName(this->defaultLanguage_) << "!" << std::endl; 153 return it->second; 147 154 } 148 155 … … 290 297 it->second->setTranslation(lineString.substr(pos + 1)); 291 298 else 292 COUT(2) << "Warning: Unknown language entry \"" << lineString.substr(0, pos) << "\" in " << getFileName(this->language_) << std::endl;299 this->createEntry(lineString.substr(0, pos), this->defaultTranslation_)->setTranslation(lineString.substr(pos + 1)); 293 300 } 294 301 else
Note: See TracChangeset
for help on using the changeset viewer.