Language class

Code in this file was forked from the dart:ui library to provide a DART version of the Language class.

An identifier used to select a user's language and formatting preferences.

This represents a Unicode Language Identifier (i.e. without Language extensions), except variants are not supported.

Locales are canonicalized according to the "preferred value" entries in the IANA Language Subtag Registry. For example, const Language('he') and const Language('iw') are equal and both have the languageCode he, because iw is a deprecated language subtag that was replaced by the subtag he.

Constructors

Language(String _languageCode, [String? _countryCode, String? scriptCode])
Creates a new Language object. The first argument is the primary language subtag, the second is the region (also referred to as 'country') subtag.
const
Language.fromSubtags({required String languageCode, String? scriptCode, String? countryCode, bool validateTags = false})
Creates a new Language object.
factory
Language.parse(String text)
Creates a new Language object by parsing text.
factory

Properties

countryCode String?
The region subtag for the locale.
no setter
hashCode int
The hash code for this object.
no setteroverride
languageCode String
The primary language subtag for the locale.
no setter
name String
Returns the English common name for the language if the language code is valid.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scriptCode String?
The script subtag for the locale.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toLanguageTag() String
Returns a syntactically valid Unicode BCP47 Language Identifier.
toString() String
Returns a string representing the locale.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Constants

ar → const Language
A constant value for Arabic.
de → const Language
A constant value for German.
el → const Language
A constant value for Greek.
en → const Language
A constant value for English.
en_GB → const Language
A constant value for English, United Kingdom.
en_US → const Language
A constant value for English, United States.
es → const Language
A constant value for Spanish.
es_ES → const Language
A constant value for Spanish, Spain.
fa → const Language
A constant value for Persian.
fr → const Language
A constant value for French.
gu → const Language
A constant value for Gujarati.
ha → const Language
A constant value for Hausa.
hi → const Language
A constant value for Hindi.
id → const Language
A constant value for Indonesian.
ig → const Language
A constant value for Igbo.
it → const Language
A constant value for Italian.
ka → const Language
A constant value for Georgian.
lv → const Language
A constant value for Latvian.
mr → const Language
A constant value for Marathi.
ms → const Language
A constant value for Malay.
nso → const Language
A constant value for Pedi.
pt → const Language
A constant value for Portuguese.
qu → const Language
A constant value for Quechua.
ro → const Language
A constant value for Romanian.
ru → const Language
A constant value for Russian.
sw → const Language
A constant value for Swahili.
ta → const Language
A constant value for Tamil.
te → const Language
A constant value for Telugu.
tg → const Language
A constant value for Tajik.
tk → const Language
A constant value for Turkmen.
tn → const Language
A constant value for Tswana.
tpi → const Language
A constant value for Tok Pisin.
tt → const Language
A constant value for Tatar.
und → const Language
A constant value for 'und'.
ur → const Language
A constant value for Urdu.
xh → const Language
A constant value for Xhosa.
yo → const Language
A constant value for Yoruba.
zh → const Language
A constant value for Chinese.
zu → const Language
A constant value for Zulu.