getEnglishName function

String getEnglishName(
  1. I18nLocale locale
)

Returns the English name of the given locale.

Implementation

String getEnglishName(I18nLocale locale) {
  final exact = _englishLocales[locale.languageTag];
  if (exact != null) {
    return exact;
  }

  if (locale.script != null) {
    final langScript = _englishLocales['${locale.language}-${locale.script}'];
    if (langScript != null) {
      return langScript;
    }
  }

  return _englishLocales[locale.language] ?? locale.language;
}