getWidgetsTranslation function

GlobalWidgetsLocalizations? getWidgetsTranslation(
  1. Locale locale
)

Creates a GlobalWidgetsLocalizations instance for the given locale.

All of the function's arguments except locale will be passed to the GlobalWidgetsLocalizations constructor. (The localeName argument of that constructor is specified by the actual subclass constructor by this function.)

The following locales are supported by this package:

  • af - Afrikaans
  • am - Amharic
  • ar - Arabic
  • as - Assamese
  • az - Azerbaijani
  • be - Belarusian
  • bg - Bulgarian
  • bn - Bengali Bangla
  • bs - Bosnian
  • ca - Catalan Valencian
  • cs - Czech
  • cy - Welsh
  • da - Danish
  • de - German (plus one country variation)
  • el - Modern Greek
  • en - English (plus 8 country variations)
  • es - Spanish Castilian (plus 20 country variations)
  • et - Estonian
  • eu - Basque
  • fa - Persian
  • fi - Finnish
  • fil - Filipino Pilipino
  • fr - French (plus one country variation)
  • gl - Galician
  • gsw - Swiss German Alemannic Alsatian
  • gu - Gujarati
  • he - Hebrew
  • hi - Hindi
  • hr - Croatian
  • hu - Hungarian
  • hy - Armenian
  • id - Indonesian
  • is - Icelandic
  • it - Italian
  • ja - Japanese
  • ka - Georgian
  • kk - Kazakh
  • km - Khmer Central Khmer
  • kn - Kannada
  • ko - Korean
  • ky - Kirghiz Kyrgyz
  • lo - Lao
  • lt - Lithuanian
  • lv - Latvian
  • mk - Macedonian
  • ml - Malayalam
  • mn - Mongolian
  • mr - Marathi
  • ms - Malay
  • my - Burmese
  • nb - Norwegian BokmÃ¥l
  • ne - Nepali
  • nl - Dutch Flemish
  • no - Norwegian
  • or - Oriya
  • pa - Panjabi Punjabi
  • pl - Polish
  • ps - Pushto Pashto
  • pt - Portuguese (plus one country variation)
  • ro - Romanian Moldavian Moldovan
  • ru - Russian
  • si - Sinhala Sinhalese
  • sk - Slovak
  • sl - Slovenian
  • sq - Albanian
  • sr - Serbian (plus 2 scripts)
  • sv - Swedish
  • sw - Swahili
  • ta - Tamil
  • te - Telugu
  • th - Thai
  • tl - Tagalog
  • tr - Turkish
  • uk - Ukrainian
  • ur - Urdu
  • uz - Uzbek
  • vi - Vietnamese
  • zh - Chinese (plus 2 country variations and 2 scripts)
  • zu - Zulu

Generally speaking, this method is only intended to be used by GlobalWidgetsLocalizations.delegate.

Implementation

GlobalWidgetsLocalizations? getWidgetsTranslation(
  Locale locale,
) {
  switch (locale.languageCode) {
    case 'af':
      return const WidgetsLocalizationAf();
    case 'am':
      return const WidgetsLocalizationAm();
    case 'ar':
      return const WidgetsLocalizationAr();
    case 'as':
      return const WidgetsLocalizationAs();
    case 'az':
      return const WidgetsLocalizationAz();
    case 'be':
      return const WidgetsLocalizationBe();
    case 'bg':
      return const WidgetsLocalizationBg();
    case 'bn':
      return const WidgetsLocalizationBn();
    case 'bs':
      return const WidgetsLocalizationBs();
    case 'ca':
      return const WidgetsLocalizationCa();
    case 'cs':
      return const WidgetsLocalizationCs();
    case 'cy':
      return const WidgetsLocalizationCy();
    case 'da':
      return const WidgetsLocalizationDa();
    case 'de': {
      switch (locale.countryCode) {
        case 'CH':
          return const WidgetsLocalizationDeCh();
      }
      return const WidgetsLocalizationDe();
    }
    case 'el':
      return const WidgetsLocalizationEl();
    case 'en': {
      switch (locale.countryCode) {
        case 'AU':
          return const WidgetsLocalizationEnAu();
        case 'CA':
          return const WidgetsLocalizationEnCa();
        case 'GB':
          return const WidgetsLocalizationEnGb();
        case 'IE':
          return const WidgetsLocalizationEnIe();
        case 'IN':
          return const WidgetsLocalizationEnIn();
        case 'NZ':
          return const WidgetsLocalizationEnNz();
        case 'SG':
          return const WidgetsLocalizationEnSg();
        case 'ZA':
          return const WidgetsLocalizationEnZa();
      }
      return const WidgetsLocalizationEn();
    }
    case 'es': {
      switch (locale.countryCode) {
        case '419':
          return const WidgetsLocalizationEs419();
        case 'AR':
          return const WidgetsLocalizationEsAr();
        case 'BO':
          return const WidgetsLocalizationEsBo();
        case 'CL':
          return const WidgetsLocalizationEsCl();
        case 'CO':
          return const WidgetsLocalizationEsCo();
        case 'CR':
          return const WidgetsLocalizationEsCr();
        case 'DO':
          return const WidgetsLocalizationEsDo();
        case 'EC':
          return const WidgetsLocalizationEsEc();
        case 'GT':
          return const WidgetsLocalizationEsGt();
        case 'HN':
          return const WidgetsLocalizationEsHn();
        case 'MX':
          return const WidgetsLocalizationEsMx();
        case 'NI':
          return const WidgetsLocalizationEsNi();
        case 'PA':
          return const WidgetsLocalizationEsPa();
        case 'PE':
          return const WidgetsLocalizationEsPe();
        case 'PR':
          return const WidgetsLocalizationEsPr();
        case 'PY':
          return const WidgetsLocalizationEsPy();
        case 'SV':
          return const WidgetsLocalizationEsSv();
        case 'US':
          return const WidgetsLocalizationEsUs();
        case 'UY':
          return const WidgetsLocalizationEsUy();
        case 'VE':
          return const WidgetsLocalizationEsVe();
      }
      return const WidgetsLocalizationEs();
    }
    case 'et':
      return const WidgetsLocalizationEt();
    case 'eu':
      return const WidgetsLocalizationEu();
    case 'fa':
      return const WidgetsLocalizationFa();
    case 'fi':
      return const WidgetsLocalizationFi();
    case 'fil':
      return const WidgetsLocalizationFil();
    case 'fr': {
      switch (locale.countryCode) {
        case 'CA':
          return const WidgetsLocalizationFrCa();
      }
      return const WidgetsLocalizationFr();
    }
    case 'gl':
      return const WidgetsLocalizationGl();
    case 'gsw':
      return const WidgetsLocalizationGsw();
    case 'gu':
      return const WidgetsLocalizationGu();
    case 'he':
      return const WidgetsLocalizationHe();
    case 'hi':
      return const WidgetsLocalizationHi();
    case 'hr':
      return const WidgetsLocalizationHr();
    case 'hu':
      return const WidgetsLocalizationHu();
    case 'hy':
      return const WidgetsLocalizationHy();
    case 'id':
      return const WidgetsLocalizationId();
    case 'is':
      return const WidgetsLocalizationIs();
    case 'it':
      return const WidgetsLocalizationIt();
    case 'ja':
      return const WidgetsLocalizationJa();
    case 'ka':
      return const WidgetsLocalizationKa();
    case 'kk':
      return const WidgetsLocalizationKk();
    case 'km':
      return const WidgetsLocalizationKm();
    case 'kn':
      return const WidgetsLocalizationKn();
    case 'ko':
      return const WidgetsLocalizationKo();
    case 'ky':
      return const WidgetsLocalizationKy();
    case 'lo':
      return const WidgetsLocalizationLo();
    case 'lt':
      return const WidgetsLocalizationLt();
    case 'lv':
      return const WidgetsLocalizationLv();
    case 'mk':
      return const WidgetsLocalizationMk();
    case 'ml':
      return const WidgetsLocalizationMl();
    case 'mn':
      return const WidgetsLocalizationMn();
    case 'mr':
      return const WidgetsLocalizationMr();
    case 'ms':
      return const WidgetsLocalizationMs();
    case 'my':
      return const WidgetsLocalizationMy();
    case 'nb':
      return const WidgetsLocalizationNb();
    case 'ne':
      return const WidgetsLocalizationNe();
    case 'nl':
      return const WidgetsLocalizationNl();
    case 'no':
      return const WidgetsLocalizationNo();
    case 'or':
      return const WidgetsLocalizationOr();
    case 'pa':
      return const WidgetsLocalizationPa();
    case 'pl':
      return const WidgetsLocalizationPl();
    case 'ps':
      return const WidgetsLocalizationPs();
    case 'pt': {
      switch (locale.countryCode) {
        case 'PT':
          return const WidgetsLocalizationPtPt();
      }
      return const WidgetsLocalizationPt();
    }
    case 'ro':
      return const WidgetsLocalizationRo();
    case 'ru':
      return const WidgetsLocalizationRu();
    case 'si':
      return const WidgetsLocalizationSi();
    case 'sk':
      return const WidgetsLocalizationSk();
    case 'sl':
      return const WidgetsLocalizationSl();
    case 'sq':
      return const WidgetsLocalizationSq();
    case 'sr': {
      switch (locale.scriptCode) {
        case 'Cyrl': {
          return const WidgetsLocalizationSrCyrl();
        }
        case 'Latn': {
          return const WidgetsLocalizationSrLatn();
        }
      }
      return const WidgetsLocalizationSr();
    }
    case 'sv':
      return const WidgetsLocalizationSv();
    case 'sw':
      return const WidgetsLocalizationSw();
    case 'ta':
      return const WidgetsLocalizationTa();
    case 'te':
      return const WidgetsLocalizationTe();
    case 'th':
      return const WidgetsLocalizationTh();
    case 'tl':
      return const WidgetsLocalizationTl();
    case 'tr':
      return const WidgetsLocalizationTr();
    case 'uk':
      return const WidgetsLocalizationUk();
    case 'ur':
      return const WidgetsLocalizationUr();
    case 'uz':
      return const WidgetsLocalizationUz();
    case 'vi':
      return const WidgetsLocalizationVi();
    case 'zh': {
      switch (locale.scriptCode) {
        case 'Hans': {
          return const WidgetsLocalizationZhHans();
        }
        case 'Hant': {
          switch (locale.countryCode) {
            case 'HK':
              return const WidgetsLocalizationZhHantHk();
            case 'TW':
              return const WidgetsLocalizationZhHantTw();
          }
          return const WidgetsLocalizationZhHant();
        }
      }
      switch (locale.countryCode) {
        case 'HK':
          return const WidgetsLocalizationZhHantHk();
        case 'TW':
          return const WidgetsLocalizationZhHantTw();
      }
      return const WidgetsLocalizationZh();
    }
    case 'zu':
      return const WidgetsLocalizationZu();
  }
  assert(false, 'getWidgetsTranslation() called for unsupported locale "$locale"');
  return null;
}