Mercurial > sumwars
changeset 2016:db8415fd72a8
Fixed bug: selecting "System default" language no longer crashes the game.
author | thegusty999 |
---|---|
date | Mon, 31 Oct 2011 19:27:48 +0000 |
parents | 4f97429b8909 |
children | f59e1368b14d |
files | src/core/gettext.cpp src/gui/optionswindow.cpp |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/gettext.cpp Mon Oct 31 19:19:07 2011 +0000 +++ b/src/core/gettext.cpp Mon Oct 31 19:27:48 2011 +0000 @@ -147,7 +147,16 @@ if (locale != m_locale) { #ifdef WIN32 - if (locale != "") + if (locale.length () == 0) + { + char loc[100]; + GetLocaleInfo(LOCALE_USER_DEFAULT, + LOCALE_SISO639LANGNAME, + loc, sizeof(loc)); + locale = loc; + } + + if (locale.length () > 0) { std::string win_locale(locale, 0, 2); std::string env = "LANGUAGE=" + win_locale; @@ -170,6 +179,7 @@ m_changed = true; return; } + #endif std::string extensions[3] = {".utf-8",".UTF-8",""};
--- a/src/gui/optionswindow.cpp Mon Oct 31 19:19:07 2011 +0000 +++ b/src/gui/optionswindow.cpp Mon Oct 31 19:27:48 2011 +0000 @@ -770,7 +770,9 @@ { DEBUGX("selected Language %s",item->getText().c_str()); StrListItem* sitem = static_cast<StrListItem*>(item); - Gettext::setLocale(sitem->m_data.c_str()); + + // Call the options set locale; this will call in turn the Gettext set locale + Options::getInstance ()->setLocale (sitem->m_data.c_str()); #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 // A re-init seems to be needed on Windows.