Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/Language.cc

    r8858 r10624  
    3737#include "util/Output.h"
    3838#include "util/StringUtils.h"
    39 #include "Core.h"
    40 #include "PathConfig.h"
     39#include "ConfigurablePaths.h"
    4140
    4241namespace orxonox
     
    203202        orxout(internal_info, context::language) << "Read default language file." << endl;
    204203
    205         const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
     204        const std::string& filepath = ConfigurablePaths::getConfigPathString() + getFilename(this->defaultLanguage_);
    206205
    207206        // This creates the file if it's not existing
     
    247246    /**
    248247        @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);
    255255
    256256        // Open the file
     
    261261        {
    262262            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;
    267265        }
    268266
     
    291289                else
    292290                {
    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;
    294292                }
    295293            }
     
    297295
    298296        file.close();
     297        return true;
    299298    }
    300299
     
    306305        orxout(verbose, context::language) << "Write default language file." << endl;
    307306
    308         const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
     307        const std::string& filepath = ConfigurablePaths::getConfigPathString() + getFilename(this->defaultLanguage_);
    309308
    310309        // Open the file
Note: See TracChangeset for help on using the changeset viewer.