Add charset support to wxLocaleIdent and accessors

Charset is important for Unix systems as some locales may not be
available without it, e.g. "xx_XX" may not be supported, but
"xx_XX.utf8" could be.
This commit is contained in:
Vadim Zeitlin
2021-08-30 01:05:14 +02:00
parent 20e3697f00
commit 592e1678ce
3 changed files with 57 additions and 3 deletions

View File

@@ -218,6 +218,9 @@ public:
/**
Set script.
Note that script value is currently ignored under Unix systems.
Return reference to @this for method chaining.
@param script
@@ -225,8 +228,26 @@ public:
*/
wxLocaleIdent& Script(const wxString& script);
/**
Set charset.
Note that this value is only used under Unix systems and simply ignored
under the other ones.
Return reference to @this for method chaining.
@param charset
Charset is a string such as "UTF-8", "ISO855915" or "KOI8R".
Supported charsets depend on the implementation and installation.
*/
wxLocaleIdent& Charset(const wxString& charset);
/**
Set modifier.
Note that this value is only used under Unix systems and simply ignored
under the other ones.
Return reference to @this for method chaining.
@param modifier
@@ -235,11 +256,26 @@ public:
*/
wxLocaleIdent& Modifier(const wxString& modifier);
/// Return the language part of the locale identifier.
const wxString& GetLanguage() const;
/// Return the region part of the locale identifier.
const wxString& GetRegion() const;
/// Return the script part of the locale identifier.
const wxString& GetScript() const;
/// Return the charset part of the locale identifier.
const wxString& GetCharset() const;
/// Return the modifier part of the locale identifier.
const wxString& GetModifier() const;
/**
Construct platform dependent name.
Format:
Windows: <language>-<script>-<REGION>
Unix: <language>_<REGION>@<modifier>
Unix: <language>_<REGION>.<charset>@<modifier>
MacOS: <language>-<script>_<REGION>
*/
wxString GetName() const;