Fix locale's loading

- Always inherit LC_ALL from environment;
- Enforce environment only if the runtime options require it;
dev-ui
Didier Raboud 2012-12-27 16:13:26 +01:00
parent 70cb629cc5
commit 0d825ed613
1 changed files with 8 additions and 5 deletions

View File

@ -312,11 +312,14 @@ bool CApplication::Create()
break;
}
std::string langStr = "LANGUAGE=";
langStr += locale;
strcpy(S_LANGUAGE, langStr.c_str());
putenv(S_LANGUAGE);
setlocale(LC_ALL, locale.c_str());
if (!locale.empty())
{
std::string langStr = "LANG=";
langStr += locale;
strcpy(S_LANGUAGE, langStr.c_str());
putenv(S_LANGUAGE);
}
setlocale(LC_ALL, "");
GetLogger()->Debug("Set locale to '%s'\n", locale.c_str());
bindtextdomain("colobot", COLOBOT_I18N_DIR);