ILibLocale class
A parsed BCP-47 locale identifier (language, script, region, variant).
Accepts a BCP-47 string (e.g. 'zh-Hans-CN'), an existing ILibLocale
to copy, or individual components. All getters return the normalized
component codes as parsed from the specifier.
Constructors
- ILibLocale([Object? language, String? region, String? variant, String? script])
-
Create a locale from a BCP-47
languagestring (e.g.'en-US'), an existing ILibLocale to copy, or separatelanguage/region/script/variantcomponents. Pass no argument for an empty locale.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- language ↔ String?
-
ISO 639 2-letter language code (e.g.
'en'), or null if unspecified.getter/setter pair - region ↔ String?
-
ISO 3166-1 alpha-2 region code (e.g.
'US'), or null if unspecified.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- script ↔ String?
-
ISO 15924 4-letter script code (e.g.
'Hans'), or null if unspecified.getter/setter pair - spec ↔ String?
-
The full BCP-47 specifier (e.g.
'zh-Hans-CN'), or null before_genSpecruns.getter/setter pair - variant ↔ String?
-
Variant tag, or null if unspecified.
getter/setter pair
Methods
-
equals(
ILibLocale other) → bool - Return true if the other locale is exactly equal to the current one.
-
getLangSpec(
) → String - Return the language locale specifier.
-
getLanguage(
) → String? - Return the ISO 639 language code for this locale.
-
getLanguageAlpha3(
) → String? - Return the language of this locale as an ISO 639 alpha-3 language code.
-
getRegion(
) → String? - Return the ISO 3166 region code for this locale.
-
getRegionAlpha3(
) → String? - Return the region of this locale as an ISO-3166-alpha3 region code.
-
getScript(
) → String? - Return the ISO 15924 script code for this locale.
-
getSpec(
) → String - Return the whole locale specifier as a string.
-
getVariant(
) → String? - Return the variant code for this locale.
-
isPseudo(
) → bool - Return true if the current locale is the special pseudo locale.
-
isValid(
) → bool -
Return true if the current locale uses a valid ISO codes
for each component of the locale that exists. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
The full BCP-47 specifier string (same as getSpec).
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
pseudoLocales
↔ List<
String> -
A list of all known pseudo-locales.
getter/setter pair
Static Methods
-
getAvailableLocales(
) → List< String> - Return all available locale specifiers.
-
languageAlpha1ToAlpha3(
String? alpha1) → String? -
Return the ISO 639 alpha-3 equivalent language code
for the given ISO 639 alpha-2 language code.
If the given alpha-2 code is not found, this function returns its argument unchanged. -
regionAlpha2ToAlpha3(
String? alpha2) → String? -
Return the ISO-3166 alpha3 equivalent region code
for the given ISO 3166 alpha2 region code.
If the given alpha2 code is not found, this function returns its argument unchanged.
Constants
-
a1toa3langmap
→ const Map<
String, String> - ISO 639 alpha-2 → alpha-3 language code lookup table.
-
a2toa3regmap
→ const Map<
String, String> - ISO 3166-1 alpha-2 → alpha-3 region code lookup table.
-
iso15924
→ const List<
String> - ISO 15924 script codes. Source: https://unicode.org/iso15924/iso15924-codes.html