Do not call setlocale with LC_ALL on windows...

...when trying to set the unavailable on win32 LC_MESSAGES, instead
just return. Also only set LANG env var when setting LC_MESSAGES and
never set the LC_ALL var. This fixes the units not submerging bug and
possibly more issues as floats will now load correctly regardless of
locale.
This commit is contained in:
Tomasz Śniatowski 2009-03-28 14:40:06 +01:00
parent e9765ca19b
commit 678d338966

View File

@ -210,17 +210,15 @@ static void wesnoth_setlocale(int category, std::string slocale,
#endif
#ifdef _WIN32
std::string env = "LANG=" + slocale;
_putenv(env.c_str());
env = "LC_ALL=" + slocale;
_putenv(env.c_str());
std::string win_locale = locale;
win_locale = win_locale.substr(0,2);
#include "language_win32.ii"
SetEnvironmentVariable("LANG", win_locale.c_str());
SetEnvironmentVariable("LC_ALL", win_locale.c_str());
if(category == LC_MESSAGES)
category = LC_ALL;
if(category == LC_MESSAGES) {
std::string env = "LANG=" + slocale;
_putenv(env.c_str());
SetEnvironmentVariable("LANG", win_locale.c_str());
return;
}
locale = win_locale.c_str();
#endif
@ -296,6 +294,10 @@ static void wesnoth_setlocale(int category, std::string slocale,
<< locale << "'.\n";
else
LOG_GENERAL << "set locale to '" << (try_loc.get()) << "' result: '" << res <<"'\n";
DBG_GENERAL << "Numeric locale: " << std::setlocale(LC_NUMERIC, NULL) << '\n';
DBG_GENERAL << "Full locale: " << std::setlocale(LC_ALL, NULL) << '\n';
}
bool set_language(const language_def& locale)