wxLocale(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– wxLocale πŸ’–

okay bestie, welcome to the wxLocale(3) page from the Erlang module definition corner of the wx manual 🫢 she's giving language settings main character energy and we're gonna read her together, no skimming, fr fr.


🌸 NAME 🌸

wxLocale β€” okay so the wxLocale class encapsulates all language-dependent settings and is a generalization of the C locale concept. that's her whole thing πŸ’…


✨ DESCRIPTION ✨

So in wxWidgets, this class manages the current locale πŸ‘‘ she also initializes and activates the wxTranslations (not implemented in wx) object that manages message catalogs. yes she does both, she's booked and busy.

Want the list of the supported languages? Go peek at the ?wxLanguage enum values πŸ¦‹ those constants can be used to specify the language in init/3 and they're also what getSystemLanguage/0 hands back to you.

Also, go see:

  • Overview i18n
  • Examples
  • wxWidgets docs: wxLocale

πŸŽ€ DATA TYPES πŸŽ€

wxLocale() :: wx:wx_object().

🧚 FUNCTIONS 🧚

buckle up babe, there's a lot of them and we're doing all of them πŸ’œ

🌟 addCatalog(This, Domain) -> boolean()

addCatalog(This, Domain) -> boolean()
    when
        This :: wxLocale(),
        Domain :: unicode:chardata().

Calls wxTranslations::AddCatalog(const wxString&).

🌟 addCatalog(This, Domain, MsgIdLanguage) -> boolean()

addCatalog(This, Domain, MsgIdLanguage) -> boolean()
    when
        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()

addCatalog(This, Domain, MsgIdLanguage, MsgIdCharset) -> boolean()
    when
        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

addCatalogLookupPathPrefix(Prefix) -> ok
    when Prefix :: unicode:chardata().

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

🌟 destroy(This :: wxLocale()) -> ok

Destroys the object 🫑 bye bestie.

🌟 getCanonicalName(This) -> unicode:charlist()

getCanonicalName(This) -> unicode:charlist()
    when This :: wxLocale().

Returns the canonical form of the current locale name ✨

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

🌟 getHeaderValue(This, Header, [Option]) -> unicode:charlist()

getHeaderValue(This, Header, [Option]) -> unicode:charlist()
    when
        This :: wxLocale(),
        Header :: unicode:chardata(),
        Option :: {szDomain, unicode:chardata()}.

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

🌟 getLanguage(This) -> integer()

getLanguage(This) -> integer() when This :: wxLocale().

Returns the ?wxLanguage constant of the current language πŸ‘‘

ngl there's a catch bestie: you can only call this function if you used the form of init/3 that takes a ?wxLanguage argument. otherwise, no dice 😭

🌟 getLanguageName(Lang) -> unicode:charlist()

getLanguageName(Lang) -> unicode:charlist() when Lang :: integer().

Returns the English name of the given language, or an empty string if this language is unknown πŸ™ˆ

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

🌟 getLocale(This) -> unicode:charlist()

getLocale(This) -> unicode:charlist() when This :: wxLocale().

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

This one's a full, human-readable name, e.g. "English" or "French" πŸ’¬ very demure, very readable.

🌟 getName(This) -> unicode:charlist()

getName(This) -> unicode:charlist() when This :: wxLocale().

Returns the current short name for the locale (as given to the constructor or to the init/3 function).

🌟 getString(This, OrigString, [Option]) -> unicode:charlist()

getString(This, OrigString, [Option]) -> unicode:charlist()
    when
        This :: wxLocale(),
        OrigString :: unicode:chardata(),
        Option :: {szDomain, unicode:chardata()}.

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

🌟 getString(This, OrigString, OrigString2, N, [Option]) -> unicode:charlist()

getString(This, OrigString, OrigString2, N, [Option]) -> unicode:charlist()
    when
        This :: wxLocale(),
        OrigString :: unicode:chardata(),
        OrigString2 :: unicode:chardata(),
        N :: integer(),
        Option :: {szDomain, unicode:chardata()}.

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

🌟 getSysName(This) -> unicode:charlist()

getSysName(This) -> unicode:charlist() when This :: wxLocale().

Returns the current platform-specific locale name, exactly as it was passed to setlocale().

Compare getCanonicalName/1 πŸ”

🌟 getSystemEncoding() -> wx:wx_enum()

getSystemEncoding() -> wx:wx_enum().

Tries to detect the user's default font encoding πŸ•΅οΈβ™€οΈ

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

🌟 getSystemEncodingName() -> unicode:charlist()

getSystemEncodingName() -> unicode:charlist().

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

ngl this string isn't particularly useful for the application, because its form is platform-dependent, so you should probably just use getSystemEncoding/0 instead πŸ’…

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

🌟 getSystemLanguage() -> integer()

getSystemLanguage() -> integer().

Tries to detect the user's default locale setting.

Returns the ?wxLanguage value, or wxLANGUAGE_UNKNOWN if the language-guessing algorithm just gave up πŸ’€

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 is not the same thing, bestie. Use wxTranslation to obtain language information.

🌟 init(This, [Option]) -> boolean()

init(This, [Option]) -> boolean()
    when
        This :: wxLocale(),
        Option :: {language, integer()} | {flags, integer()}.

Initializes the wxLocale instance ✨

okay so this call has several global side effects and you really should understand them:

first of all, the application locale gets changed β€” and heads up, that will affect a whole bunch 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.

🌟 init(This, Name, [Option]) -> boolean()

init(This, Name, [Option]) -> boolean()
    when
        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 πŸ™ˆ

🌟 isLoaded(This, Domain) -> boolean()

isLoaded(This, Domain) -> boolean()
    when This :: wxLocale(), Domain :: unicode:chardata().

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

🌟 isOk(This) -> boolean()

isOk(This) -> boolean() when This :: wxLocale().

Returns true if the locale could be set successfully βœ…

🌟 new() -> wxLocale()

new() -> wxLocale().

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

🌟 new(Language) -> wxLocale()

new(Language) -> wxLocale() when Language :: integer();
   (Name) -> wxLocale() when Name :: unicode:chardata().

Equivalent to: new/2

🌟 new(Language, [Option]) -> wxLocale()

new(Language, [Option]) -> wxLocale()
    when Language :: integer(), Option :: {flags, integer()};
   (Name, [Option]) -> wxLocale()
    when
        Name :: unicode:chardata(),
        Option ::
            {shortName, unicode:chardata()} |
            {locale, unicode:chardata()} |
            {bLoadDefault, boolean()}.

See init/3 for the parameters description πŸ‘€

And yep, same tea as before: 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 the 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.


and that's the whole page bestie, you ate that πŸ“πŸ’–

Ericsson AB wrote this one, it's from wx 2.6, and the page itself is literally called wxLocale(3) β€” slay, periodt πŸ‘‘βœ¨

πŸ“¦ where this page comes from