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
final germanNames = DisplayNames(locale: Locale.parse('en-US'));
print(germanNames.ofLocale(Locale.parse('de-DE'))); // German (Germany)
Regions:
// Display the name of the region Germany in Spanish
final spanishNames = DisplayNames(locale: Locale.parse('es-419'));
print(spanishNames.ofRegion('DE')); // Alemania
Classes
- DisplayNames
- Provides localized names for languages, regions, scripts, and currencies.
- Locale
- Representing a Unicode locale identifier.
Enums
- DisplayType
- The types of display names that can be requested.
- Fallback
- What to do if a display name is not found.
- LanguageDisplay
- How to display language names.
- Style
- Used for multiple option types which confirm to the triad of narrow/short/long.