Remove unnecessary checks for wxLANGUAGE_DEFAULT

Simplify the code by not checking for language == wxLANGUAGE_DEFAULT in
wxLocale::Init(): this can't happen because we use the system language
when passed wxLANGUAGE_DEFAULT as parameter and return false immediately
if we can't determine the system language.
This commit is contained in:
Vadim Zeitlin
2017-07-14 18:53:29 +02:00
parent 7836dfbc77
commit 9b387434a0

View File

@@ -424,7 +424,6 @@ bool wxLocale::Init(int language, int flags)
// Set the locale:
#if defined(__UNIX__) && !defined(__WXMAC__)
if (language != wxLANGUAGE_DEFAULT)
locale = info->CanonicalName;
const char *retloc = wxSetlocaleTryUTF8(LC_ALL, locale);
@@ -498,8 +497,6 @@ bool wxLocale::Init(int language, int flags)
#elif defined(__WIN32__)
const char *retloc = "C";
if ( language != wxLANGUAGE_DEFAULT )
{
if ( info->WinLang == 0 )
{
wxLogWarning(wxS("Locale '%s' not supported by OS."), name.c_str());
@@ -535,12 +532,6 @@ bool wxLocale::Init(int language, int flags)
retloc = wxSetlocale(LC_ALL, locale);
}
}
}
else // language == wxLANGUAGE_DEFAULT
{
retloc = wxSetlocale(LC_ALL, wxEmptyString);
}
#if wxUSE_UNICODE && (defined(__VISUALC__) || defined(__MINGW32__))
// VC++ setlocale() (also used by Mingw) can't set locale to languages that
// can only be written using Unicode, therefore wxSetlocale() call fails
@@ -560,9 +551,6 @@ bool wxLocale::Init(int language, int flags)
if ( !retloc )
ret = false;
#elif defined(__WXMAC__)
if (lang == wxLANGUAGE_DEFAULT)
locale.clear();
else
locale = info->CanonicalName;
const char *retloc = wxSetlocale(LC_ALL, locale);