Allow creating wxUILocale objects for any locale
Creating such objects (without using them for the UI) is supported under all platforms, so allow doing it. Note that this is only supported under Unix systems when locale_t and related functionality is available, but this should be the case just about everywhere by now. Add a test (or, rather, replace an existing test which was disabled by default) checking that we can now get locale information about any locale, not necessarily the currently used one.
This commit is contained in:
@@ -142,7 +142,7 @@ wxString wxLocaleIdent::GetName() const
|
||||
// LCID-based wxUILocale implementation for MSW
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// TODO-XP: Drop it when we don't support XP any longer.
|
||||
// TODO-XP: Replace with wxUILocaleImplName when we don't support XP any longer.
|
||||
class wxUILocaleImplLCID : public wxUILocaleImpl
|
||||
{
|
||||
public:
|
||||
@@ -367,6 +367,21 @@ wxUILocaleImpl* wxUILocaleImpl::CreateForLanguage(const wxLanguageInfo& info)
|
||||
return new wxUILocaleImplLCID(info.GetLCID());
|
||||
}
|
||||
|
||||
/* static */
|
||||
wxUILocaleImpl* wxUILocaleImpl::CreateForLocale(const wxLocaleIdent& locId)
|
||||
{
|
||||
if ( !wxUILocaleImplName::CanUse() )
|
||||
{
|
||||
// We could try finding the LCID matching the name, but support for XP
|
||||
// will be dropped soon, so it just doesn't seem worth to do it (note
|
||||
// that LocaleNameToLCID() itself is not available in XP neither, so we
|
||||
// can't just use it here).
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new wxUILocaleImplName(locId.GetName());
|
||||
}
|
||||
|
||||
/* static */
|
||||
int
|
||||
wxUILocale::CompareStrings(const wxString& lhs,
|
||||
|
Reference in New Issue
Block a user