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
dev-ui
krzys-h 2013-12-31 17:20:03 +01:00
parent 999490e88b
commit 8d30791595
2 changed files with 18 additions and 8 deletions

View File

@ -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.

View File

@ -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;