Always succeed in CreateForLanguage(wxLANGUAGE_ENGLISH)
This is required for wxLocale compatibility, as using wxLANGUAGE_ENGLISH is supposed to be the same as using "C" locale (even if it isn't, really) at wxLocale level.
This commit is contained in:
@@ -50,7 +50,9 @@ public:
|
|||||||
// The language passed to this function is a valid language, i.e. neither
|
// The language passed to this function is a valid language, i.e. neither
|
||||||
// wxLANGUAGE_UNKNOWN nor wxLANGUAGE_DEFAULT.
|
// wxLANGUAGE_UNKNOWN nor wxLANGUAGE_DEFAULT.
|
||||||
//
|
//
|
||||||
// It may return NULL in case of failure.
|
// It may return NULL in case of failure, but never does so for English
|
||||||
|
// languages because wxLocale(wxLANGUAGE_ENGLISH) is always supposed to
|
||||||
|
// work, so it just falls back on CreateStdC() if it fails to create it.
|
||||||
static wxUILocaleImpl* CreateForLanguage(const wxLanguageInfo& info);
|
static wxUILocaleImpl* CreateForLanguage(const wxLanguageInfo& info);
|
||||||
|
|
||||||
// Use this locale in the UI.
|
// Use this locale in the UI.
|
||||||
|
@@ -22,6 +22,10 @@
|
|||||||
|
|
||||||
#include "wx/uilocale.h"
|
#include "wx/uilocale.h"
|
||||||
|
|
||||||
|
#ifndef __WINDOWS__
|
||||||
|
#include "wx/language.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wx/private/uilocale.h"
|
#include "wx/private/uilocale.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -57,7 +61,17 @@ wxUILocaleImpl* wxUILocaleImpl::CreateForLanguage(const wxLanguageInfo& info)
|
|||||||
locId.Modifier(mod);
|
locId.Modifier(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CreateForLocale(locId);
|
wxUILocaleImpl* impl = CreateForLocale(locId);
|
||||||
|
if ( !impl &&
|
||||||
|
(info.Language == wxLANGUAGE_ENGLISH ||
|
||||||
|
info.Language == wxLANGUAGE_ENGLISH_US) )
|
||||||
|
{
|
||||||
|
// For compatibility, never fail creating locale for neutral or US
|
||||||
|
// English, even if it's unavailable on the current system somehow.
|
||||||
|
impl = CreateStdC();
|
||||||
|
}
|
||||||
|
|
||||||
|
return impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !__WINDOWS__
|
#endif // !__WINDOWS__
|
||||||
|
Reference in New Issue
Block a user