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:
Vadim Zeitlin
2021-08-29 14:50:54 +02:00
parent 07e79b7736
commit 45f9908e05
8 changed files with 193 additions and 38 deletions

View File

@@ -45,6 +45,9 @@ public:
// Get the object corresponding to the currently used locale.
static const wxUILocale& GetCurrent();
// Create the object corresponding to the given locale.
explicit wxUILocale(const wxLocaleIdent& localeId);
// Get the platform-dependent name of the current locale.
wxString GetName() const;
@@ -62,7 +65,8 @@ public:
~wxUILocale();
private:
// Ctor is private, use static accessor to get objects of this class.
// Default ctor is private and exists only for implementation reasons,
// wxUILocale objects can't be invalid.
wxUILocale() : m_impl(NULL) { }
// Used by UseDefault().