wxLocale(3erl)

๐Ÿ“ฆ
version 25.3.2.8 ยท 5 versions
, in ubuntu noble

๐Ÿ’… wxLocale(3erl) โ€” Erlang Module Definition โœจ

Okay bestie, gather round because this is the wxLocale module and it's literally the main character of language-dependent settings in Erlang. The manual is wxLocale(3erl) and it's giving โœจinternationalization realnessโœจ โ€” no cap. ๐ŸŽ€

๐Ÿฆ‹ DESCRIPTION

So wxLocale encapsulates all the language-dependent settings and is basically a generalization of the C locale concept. It's like the C locale but make it fashion. ๐Ÿ’…

In wxWidgets this class manages the current locale. It also initializes and activates the wxTranslations (not implemented in wx) object that manages message catalogs. The way it just runs the whole translation situation? Obsessed. ๐ŸŒธ

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. Iykyk. ๐Ÿ”ฅ

See:

  • Overview i18n
  • Examples
  • wxXLocale (not implemented in wx)
  • wxTranslations (not implemented in wx)

wxWidgets docs: wxLocale


๐ŸŒˆ DATA TYPES

  • wxLocale() = wx:wx_object()

๐Ÿ‘‘ EXPORTS

๐Ÿ’– new() -> wxLocale()

This is the default constructor and it does nothing to initialize the object โ€” zero, zilch, nada. init/3 must be used to do that. So don't come for this constructor expecting it to do the work, bestie. ๐Ÿ˜ญ

๐Ÿ’œ new(Language) -> wxLocale()

๐Ÿฆ‹ new(Name) -> wxLocale()

Types:

Name = unicode:chardata()

๐ŸŽ€ new(Language, Options :: [Option]) -> wxLocale()

๐ŸŒธ new(Name, Options :: [Option]) -> wxLocale()

Types:

Name = unicode:chardata()
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 โ€” and yes I'm about to spill the tea: 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. It's giving "I have the power" energy, honestly. โšก

๐Ÿงš destroy(This :: wxLocale()) -> ok

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. It's like ctrl+z for your locale. ๐Ÿ’€

๐Ÿ’ซ init(This) -> boolean()

Types:

This = wxLocale()

๐Ÿ”ฅ init(This, Options :: [Option]) -> boolean()

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. So if it returns false... that's a no from the locale, bestie. ๐Ÿ™ˆ

๐ŸŒŸ init(This, Name, Options :: [Option]) -> boolean()

Types:

This = wxLocale()
Name = unicode:chardata()
Option =
    {shortName, unicode:chardata()} |
    {locale, unicode:chardata()} |
    {bLoadDefault, boolean()}
Deprecated: This form is deprecated, use the other one unless you know what you are doing. Deadass โ€” if you use this, you better know what you're doing. ๐Ÿ’…

๐ŸŒบ addCatalog(This, Domain) -> boolean()

Types:

This = wxLocale()
Domain = unicode:chardata()

Calls wxTranslations::AddCatalog(const wxString&).

๐Ÿ“ addCatalog(This, Domain, MsgIdLanguage) -> boolean()

Types:

This = wxLocale()
Domain = unicode:chardata()
MsgIdLanguage = wx:wx_enum()

Calls wxTranslations::AddCatalog(const wxString&, wxLanguage) (not implemented in wx).

๐Ÿฆ„ addCatalog(This, Domain, MsgIdLanguage, MsgIdCharset) -> boolean()

Types:

This = wxLocale()
Domain = unicode:chardata()
MsgIdLanguage = wx:wx_enum()
MsgIdCharset = unicode:chardata()

Calls wxTranslations::AddCatalog(const wxString&, wxLanguage, const wxString&) (not implemented in wx).

๐ŸŽ€ addCatalogLookupPathPrefix(Prefix) -> ok

Types:

Prefix = unicode:chardata()

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

๐Ÿ’Ž getCanonicalName(This) -> unicode:charlist()

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.

๐Ÿ”ฎ getLanguage(This) -> integer()

Types:

This = wxLocale()

Returns the ?wxLanguage constant of current language.

Note: You can call this function only if you used the form of init/3 that takes ?wxLanguage argument. So if you didn't use that form... bestie, this function won't come to the phone. ๐Ÿ“ต

๐ŸŒˆ getLanguageName(Lang) -> unicode:charlist()

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.

๐Ÿงธ getLocale(This) -> unicode:charlist()

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". Like, it's not out here giving you cryptic codes โ€” it's giving you the actual word. ๐Ÿ’–

๐Ÿฆ‹ getName(This) -> unicode:charlist()

Types:

This = wxLocale()

Returns the current short name for the locale (as given to the constructor or the init/3 function). Short and sweet, just like this function. ๐ŸŽ€

๐ŸŒธ getString(This, OrigString) -> unicode:charlist()

Types:

This = wxLocale()
OrigString = unicode:chardata()

๐Ÿ’œ getString(This, OrigString, Options :: [Option]) -> unicode:charlist()

Types:

This = wxLocale()
OrigString = unicode:chardata()
Option = {szDomain, unicode:chardata()}

Calls wxGetTranslation(const wxString&, const wxString&).

๐ŸŽ€ getString(This, OrigString, OrigString2, N) -> unicode:charlist()

Types:

This = wxLocale()
OrigString = OrigString2 = unicode:chardata()
N = integer()

๐ŸŒŸ getString(This, OrigString, OrigString2, N, Options :: [Option]) -> unicode:charlist()

Types:

This = wxLocale()
OrigString = OrigString2 = unicode:chardata()
N = integer()
Option = {szDomain, unicode:chardata()}

Calls wxGetTranslation(const wxString&, const wxString&, unsigned, const wxString&).

๐Ÿ’ซ getHeaderValue(This, Header) -> unicode:charlist()

Types:

This = wxLocale()
Header = unicode:chardata()

๐Ÿ”ฅ getHeaderValue(This, Header, Options :: [Option]) -> unicode:charlist()

Types:

This = wxLocale()
Header = unicode:chardata()
Option = {szDomain, unicode:chardata()}

Calls wxTranslations::GetHeaderValue() (not implemented in wx).

๐Ÿงš getSysName(This) -> unicode:charlist()

Types:

This = wxLocale()

Returns current platform-specific locale name as passed to setlocale().

Compare getCanonicalName/1.

๐ŸŒบ getSystemEncoding() -> wx:wx_enum()

Tries to detect the user's default font encoding.

Returns ?wxFontEncoding() value or wxFONTENCODING_SYSTEM if it couldn't be determined. So if it couldn't figure it out, it just hits you with wxFONTENCODING_SYSTEM โ€” which is giving "I tried, bestie". ๐Ÿ˜ญ

๐Ÿ“ getSystemEncodingName() -> unicode:charlist()

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. Lowkey, this one's just for the vibes.

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

๐Ÿฆ„ getSystemLanguage() -> integer()

Tries to detect the user's default locale setting.

Returns the ?wxLanguage value or wxLANGUAGE_UNKNOWN if the language-guessing algorithm failed. So if the guessing game didn't work out, you get wxLANGUAGE_UNKNOWN โ€” which is the "it's giving unknown" of locale values. ๐Ÿ’€

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. This is important โ€” don't be out here confusing locale with UI language, bestie. They are NOT the same. ๐Ÿšจ

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

๐Ÿ’Ž isLoaded(This, Domain) -> boolean()

Types:

This = wxLocale()
Domain = unicode:chardata()

Calls wxTranslations::IsLoaded() (not implemented in wx).

๐Ÿ”ฎ isOk(This) -> boolean()

Types:

This = wxLocale()

Returns true if the locale could be set successfully. So like, it's the vibe check for your locale. If it's true, slay. If it's false... well. ๐Ÿ’…


Okay so that's the whole module, bestie. And before I go โ€” this manual page was brought to you by the wxWidgets team, it's version wx 2.2.2.1, and it's the wxLocale(3erl) manual page. Now go forth and localize the heck out of your app. Mwah! ๐Ÿ’‹โœจ

๐Ÿ“ฆ where this page comes from