wxLocale

wxLocale

wxLocale
Functions for wxLocale class

wxLocale class encapsulates all language-dependent settings and is a generalization of the C locale concept.

In wxWidgets this class manages current locale. It also initializes and activates wxTranslations (not implemented in wx) object that manages message catalogs.

For a list of the supported languages, please see ?wxLanguage enum values. These constants may be used to specify the language in init/3 and are returned by getSystemLanguage/0.

See: Overview i18n, Examples, wxXLocale (not implemented in wx), wxTranslations (not implemented in wx)

wxWidgets docs: wxLocale

This is the default constructor and it does nothing to initialize the object: init/3 must be used to do that.

Types

Option =
    {shortName, unicode:chardata()} |
    {locale, unicode:chardata()} |
    {bLoadDefault, boolean()}

See init/3 for parameters description.

The call of this function has several global side effects which you should understand: first of all, the application locale is changed - note that this will affect many of standard C library functions such as printf() or strftime(). Second, this wxLocale object becomes the new current global locale for the application and so all subsequent calls to ?wxGetTranslation() will try to translate the messages using the message catalogs for this locale.

The destructor, like the constructor, also has global side effects: the previously set locale is restored and so the changes described in init/3 documentation are rolled back.

Types

This = wxLocale()
Option = {language, integer()} | {flags, integer()}

Initializes the wxLocale instance.

The call of this function has several global side effects which you should understand: first of all, the application locale is changed - note that this will affect many of standard C library functions such as printf() or strftime(). Second, this wxLocale object becomes the new current global locale for the application and so all subsequent calls to ?wxGetTranslation() will try to translate the messages using the message catalogs for this locale.

Return: true on success or false if the given locale couldn't be set.

Types

Calls wxFileTranslationsLoader::AddCatalogLookupPathPrefix() (not implemented in wx).

Types

This = wxLocale()

Returns the canonical form of current locale name.

Canonical form is the one that is used on UNIX systems: it is a two- or five-letter string in xx or xx_YY format, where xx is ISO 639 code of language and YY is ISO 3166 code of the country. Examples are "en", "en_GB", "en_US" or "fr_FR". This form is internally used when looking up message catalogs. Compare getSysName/1.

Types

This = wxLocale()

Returns the ?wxLanguage constant of current language.

Note that you can call this function only if you used the form of init/3 that takes ?wxLanguage argument.

Types

Lang = integer()

Returns English name of the given language or empty string if this language is unknown.

See GetLanguageInfo() (not implemented in wx) for a remark about special meaning of wxLANGUAGE_DEFAULT.

Types

This = wxLocale()

Returns the locale name as passed to the constructor or init/3.

This is a full, human-readable name, e.g. "English" or "French".

Tries to detect the user's default font encoding.

Returns ?wxFontEncoding() value or wxFONTENCODING_SYSTEM if it couldn't be determined.

Tries to detect the name of the user's default font encoding.

This string isn't particularly useful for the application as its form is platform-dependent and so you should probably use getSystemEncoding/0 instead.

Returns a user-readable string value or an empty string if it couldn't be determined.

Tries to detect the user's default locale setting.

Returns the ?wxLanguage value or wxLANGUAGE_UNKNOWN if the language-guessing algorithm failed.

Note: This function works with locales and returns the user's default locale. This may be, and usually is, the same as their preferred UI language, but it's not the same thing. Use wxTranslation to obtain language information.

See: wxTranslations::GetBestTranslation() (not implemented in wx)

Types

This = wxLocale()

Returns true if the locale could be set successfully.