wxLocale(3)
π 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 ofinit/3that takes a?wxLanguageargument. 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
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms