display_names library

Formatting names in different locales.

For a given Locale, show the name of some information in that locale. Provides several options as part of the DisplayNames constructor, such as Style, LanguageDisplay, or Fallback.

Languages:

// Display the name of the language German in English
DisplayNames(locale: Locale.parse('en-US'))
  .ofLocale(Locale.parse('de-DE')); // German (Germany)

// Display the name of the language French in Chinese
DisplayNames(locale: Locale.parse('zh-Hant'))
  .ofLocale(Locale.parse('fr')); // 法文

Regions:

// Display the name of the region es-419, Latin America, in English
DisplayNames(locale: Locale.parse('en'))
  .ofRegion('419'); // Latin America

// Display the name of the region Germany in Spanish
DisplayNames(locale: Locale.parse('es-419'))
  .ofRegion('DE'); // Alemania

Classes

DisplayNames
Provides localized names for languages, regions, scripts, and currencies.
Locale
Representing a Unicode locale identifier.

Enums

DisplayType
Fallback
LanguageDisplay
Style
Used for multiple option types which confirm to the triad of narrow/short/long.