diff options
author | krzys-h <krzys_h@interia.pl> | 2013-12-31 17:20:03 +0100 |
---|---|---|
committer | krzys-h <krzys_h@interia.pl> | 2013-12-31 17:20:03 +0100 |
commit | 8d30791595cf981b08310472faa2066a99aa9595 (patch) | |
tree | c862897b4e435c302a877ad29402eef63647e98c /src | |
parent | 999490e88bc699b671b94b88c9a4327d963db378 (diff) | |
download | colobot-8d30791595cf981b08310472faa2066a99aa9595.tar.gz colobot-8d30791595cf981b08310472faa2066a99aa9595.tar.bz2 colobot-8d30791595cf981b08310472faa2066a99aa9595.zip |
Ability to set language via ini file
If language autodetection doesn't work, someone might want to manually force the game to use correct language without using -language parameter every time
Diffstat (limited to 'src')
-rw-r--r-- | src/app/app.cpp | 10 | ||||
-rw-r--r-- | src/common/profile.cpp | 16 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp index 566be33..8b5533e 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -425,6 +425,16 @@ bool CApplication::Create() return false; } + if (GetProfile().GetLocalProfileString("Language", "Lang", path)) { + Language language; + if (ParseLanguage(path, language)) { + m_language = language; + GetLogger()->Error("Setting language '%s' from ini file\n", path.c_str()); + } else { + GetLogger()->Error("Invalid language '%s' in ini file\n", path.c_str()); + } + } + SetLanguage(m_language); //Create the sound instance. diff --git a/src/common/profile.cpp b/src/common/profile.cpp index 77c70c3..ee3e873 100644 --- a/src/common/profile.cpp +++ b/src/common/profile.cpp @@ -91,7 +91,7 @@ bool CProfile::SetLocalProfileString(std::string section, std::string key, std:: } catch (std::exception & e) { - GetLogger()->Error("Error on parsing profile: %s\n", e.what()); + GetLogger()->Info("Error on parsing profile: %s\n", e.what()); return false; } return true; @@ -106,7 +106,7 @@ bool CProfile::GetLocalProfileString(std::string section, std::string key, std:: } catch (std::exception & e) { - GetLogger()->Error("Error on parsing profile: %s\n", e.what()); + GetLogger()->Info("Error on parsing profile: %s\n", e.what()); return false; } return true; @@ -122,7 +122,7 @@ bool CProfile::SetLocalProfileInt(std::string section, std::string key, int valu } catch (std::exception & e) { - GetLogger()->Error("Error on parsing profile: %s\n", e.what()); + GetLogger()->Info("Error on parsing profile: %s\n", e.what()); return false; } return true; @@ -137,7 +137,7 @@ bool CProfile::GetLocalProfileInt(std::string section, std::string key, int &val } catch (std::exception & e) { - GetLogger()->Error("Error on parsing profile: %s\n", e.what()); + GetLogger()->Info("Error on parsing profile: %s\n", e.what()); return false; } return true; @@ -153,7 +153,7 @@ bool CProfile::SetLocalProfileFloat(std::string section, std::string key, float } catch (std::exception & e) { - GetLogger()->Error("Error on parsing profile: %s\n", e.what()); + GetLogger()->Info("Error on parsing profile: %s\n", e.what()); return false; } return true; @@ -168,7 +168,7 @@ bool CProfile::GetLocalProfileFloat(std::string section, std::string key, float } catch (std::exception & e) { - GetLogger()->Error("Error on parsing profile: %s\n", e.what()); + GetLogger()->Info("Error on parsing profile: %s\n", e.what()); return false; } return true; @@ -178,7 +178,7 @@ bool CProfile::GetLocalProfileFloat(std::string section, std::string key, float std::vector< std::string > CProfile::GetLocalProfileSection(std::string section, std::string key) { std::vector< std::string > ret_list; - boost::regex re(key + "[0-9]*"); //we want to match all key followed my any number + boost::regex re(key + "[0-9]*"); //we want to match all key followed by any number try { @@ -192,7 +192,7 @@ std::vector< std::string > CProfile::GetLocalProfileSection(std::string section, } catch (std::exception & e) { - GetLogger()->Error("Error on parsing profile: %s\n", e.what()); + GetLogger()->Info("Error on parsing profile: %s\n", e.what()); } return ret_list; |