Language.parse constructor

Language.parse(
  1. String text
)

Creates a new Language object by parsing text.

The text must be a valid language identifier with valid subtag values according to CLDR supplemental data: language, script and region for each of languageCode, scriptCode and countryCode respectively.

The text should be in the correct format e.g. en_US, de or ar_Arab_AE to allow parsing of the subtags.

The languageCode subtag is required. When there is no language subtag, the parameter should an empty String or set to "und". When not supplied, the languageCode defaults to "und", an undefined language code.

The countryCode subtag is optional. When there is no country subtag, the parameter should be omitted or passed null instead of an empty-string.

The scriptCode subtag is optional. When there is no script subtag, the parameter should be omitted or passed null instead of an empty-string.

Implementation

factory Language.parse(String text) => text.toLocale();