summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2012-12-27 16:13:26 +0100
committerDidier Raboud <odyx@debian.org>2012-12-27 16:13:26 +0100
commit0d825ed613ae62b0ed22a7e7f9ea1f001e3f8ea3 (patch)
tree29c4b94f0fd48a40c7ad1925d4b307cfc84943f5 /src
parent70cb629cc5728398e177c9b6bb7548847ce0be28 (diff)
downloadcolobot-0d825ed613ae62b0ed22a7e7f9ea1f001e3f8ea3.tar.gz
colobot-0d825ed613ae62b0ed22a7e7f9ea1f001e3f8ea3.tar.bz2
colobot-0d825ed613ae62b0ed22a7e7f9ea1f001e3f8ea3.zip
Fix locale's loading
- Always inherit LC_ALL from environment; - Enforce environment only if the runtime options require it;
Diffstat (limited to 'src')
-rw-r--r--src/app/app.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 118e100..27adcb1 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -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);