LocaleId class Locales
A locale identifier (= Unicode language identifier + extensions and privateUse field).
It supports the following identifier types:
- BCP47 language tags,
- Unicode locale identifiers,
- Unicode BCP47 locale identifiers
- Unicode CLDR locale identifiers
(See https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers for definitions.)
- Inheritance
-
- Object
- LanguageId
- LocaleId
Constructors
-
LocaleId({String? lang, String? script, String? region, List<
String> variants = const [], List<String> extensions = const [], String? privateUse, String? legacyExtensions, String? characterEncoding, String? remainder, UnicodeExtensions? unicodeExtensions}) - Create a new LocaleId from the constituent fields.
- LocaleId.parse(String input)
-
Parse the input into a LocaleId
factory
Properties
- characterEncoding → String?
-
Character encoding
final
-
extensions
→ List<
String> -
Language tag extensions
final
- hashCode → int
-
The hash code for this object.
no setter
- isEmpty → bool
-
Check if no attributes are defined
no setter
- isGrandfatheredIrregular → bool
-
Legacy BCP47 language tag
no setterinherited
- isLangNullOrUnd → bool
-
The language is null or 'und' or 'root'.
no setterinherited
- isPrivateUse → bool
-
Private Use Tag, which does not contain any other parts (except for possibly
remainder
)no setter - isWellFormed → bool
-
Check if the locale is well-formed language tag (BCP47 or Unicode),
but not a grandfathered or private use tag.
no setter
- isWellFormedBCP47 → bool
-
Check if the locale is well-formed BCP47 language tag
no setter
- isWellFormedPrivateUse → bool
-
Tag with only private use field (allowed for BCP47 tag, not allowed for Unicode tag)
no setter
- isWellFormedUnicode → bool
-
Check if the locale is well-formed Unicode locale identifier
no setter
- lang → String?
-
Language tag language part
finalinherited
- langOrNullIfUndefined → String?
-
Get the language or null in case it is 'und' or 'root'
no setterinherited
- langOrUnd → String?
-
Get the language or 'und' in case it is 'und' or 'root'
no setterinherited
- legacyExtensions → String?
-
Legacy extensions (LDML versions before 1.7.2)
final
- privateUse → String?
-
Language tag private use part
final
- region → String?
-
Language tag region part
finalinherited
- remainder → String?
-
Remainder of input that cannot be parsed
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- script → String?
-
Language tag script part
finalinherited
- unicodeExtensions → UnicodeExtensions?
-
final
-
variants
→ List<
String> -
Language tag variants
finalinherited
Methods
-
addLikelySubTags(
) → LocaleId -
Return a LocaleId with likely sub tags added.
override
-
canonicalize(
) → LocaleId -
Return a LocaleId in canonical form.
override
-
equalLanguageScriptAndRegion(
BaseLanguageId other) → bool -
Check if two locales have same language, script and region
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeLikelySubTags(
{bool favorScript = false}) → LocaleId -
Return a LocaleId with likely sub tags removed.
override
-
toBCP47(
) → String - Format the locale in BCP47 format
-
toString(
) → String - A string representation of this object.
-
toUnicode(
) → String - Format the locale in Unicode format. The identifier can have an empty language field.
-
toUnicodeBCP47(
) → String - Format the locale in Unicode BCP47 format.
-
toUnicodeCLDR(
) → String - Format the locale in Unicode CLDR format. It uses '_' as separator instead of '-' and if lang, script, region and variants are all empty it is 'root'.
Operators
-
operator ==(
Object other) → bool - Two LocaleIds are considered equal when all fields are equal (ignoring the remainder)