Enhance wxUILocale and wxLocaleIdent

Many improvements and fixes to wxUILocale:

- Add wxUILocale method for retrieving wxLocaleIdent identifier,
  localized names, layout direction.
- Add wxLocaleIdent attributes, getter, and setter for
  platform-dependent tags under Windows: extension, sort order.
- Modify method wxLocaleIdent::FromTag to support not only BCP 47-like
  tags, but also platform-dependent syntax.
- Modify method wxLocaleIdent::GetTag to allow specifying the tag type.
- Update internat sample to better show using wxUILocale.
- Update German and French message catalogs for internat sample (German
  fully translated, French msgIds only).
- Introduced wxUILocaleImplStdC under Windows, because locale "en-US" is
  not equivalent to the C locale.
- Adjust wxLocale class to restore previous wxUILocale in the
  destructor.
- Implement wxLocale::GetInfo method through wxUILocale methods.
- Removed LCID dependency in wxLocale.
- Move the implementation of some static wxUILocale methods from
  intl.cpp to uilocale.cpp.

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>

Closes #2615.
This commit is contained in:
utelle
2022-03-28 01:11:40 +02:00
committed by Vadim Zeitlin
parent 891cbb1e0e
commit 6d6e5cde21
17 changed files with 2015 additions and 673 deletions

View File

@@ -32,6 +32,31 @@ enum wxLayoutDirection
// wxLocaleCategory: the category of locale settings
// ----------------------------------------------------------------------------
enum wxLocaleTagType
{
// Default (tag as given or else same as wxLOCALE_TAGTYPE_SYSTEM)
wxLOCALE_TAGTYPE_DEFAULT,
// Default type of the system (platform-dependent)
wxLOCALE_TAGTYPE_SYSTEM,
// BCP47-like type: <language>[-<script>][-<region>][-<modifier>]
wxLOCALE_TAGTYPE_BCP47,
// macOS type: <language>[-<script>][_<region>]
wxLOCALE_TAGTYPE_MACOS,
// POSIX type: <language>_<region>[.<charset>][@{<scriptalias>|<modifier>}]
wxLOCALE_TAGTYPE_POSIX,
// Windows type: <language>[-<script>][-<region>][-<extension>][_<sortorder>]
wxLOCALE_TAGTYPE_WINDOWS
};
// ----------------------------------------------------------------------------
// wxLocaleCategory: the category of locale settings
// ----------------------------------------------------------------------------
enum wxLocaleCategory
{
// (any) numbers
@@ -74,6 +99,27 @@ enum wxLocaleInfo
};
// ----------------------------------------------------------------------------
// wxLocaleName: the items understood by wxLocale::GetLocalizedName()
// ----------------------------------------------------------------------------
enum wxLocaleName
{
wxLOCALE_NAME_LOCALE,
wxLOCALE_NAME_LANGUAGE,
wxLOCALE_NAME_COUNTRY
};
// ----------------------------------------------------------------------------
// wxLocaleForm: the forms of names understood by wxLocale::GetLocalizedName()
// ----------------------------------------------------------------------------
enum wxLocaleForm
{
wxLOCALE_FORM_NATIVE,
wxLOCALE_FORM_ENGLISH
};
// ----------------------------------------------------------------------------
// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc.
// translation information