import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:intl/intl.dart' as intl;

import 'app_localizations_af.dart';
import 'app_localizations_am.dart';
import 'app_localizations_ar.dart';
import 'app_localizations_az.dart';
import 'app_localizations_be.dart';
import 'app_localizations_bg.dart';
import 'app_localizations_bn.dart';
import 'app_localizations_ca.dart';
import 'app_localizations_cs.dart';
import 'app_localizations_da.dart';
import 'app_localizations_de.dart';
import 'app_localizations_el.dart';
import 'app_localizations_en.dart';
import 'app_localizations_es.dart';
import 'app_localizations_et.dart';
import 'app_localizations_eu.dart';
import 'app_localizations_fa.dart';
import 'app_localizations_fi.dart';
import 'app_localizations_fil.dart';
import 'app_localizations_fr.dart';
import 'app_localizations_gl.dart';
import 'app_localizations_gu.dart';
import 'app_localizations_he.dart';
import 'app_localizations_hi.dart';
import 'app_localizations_hr.dart';
import 'app_localizations_hu.dart';
import 'app_localizations_hy.dart';
import 'app_localizations_id.dart';
import 'app_localizations_is.dart';
import 'app_localizations_it.dart';
import 'app_localizations_ja.dart';
import 'app_localizations_ka.dart';
import 'app_localizations_kk.dart';
import 'app_localizations_km.dart';
import 'app_localizations_kn.dart';
import 'app_localizations_ko.dart';
import 'app_localizations_ky.dart';
import 'app_localizations_lo.dart';
import 'app_localizations_lt.dart';
import 'app_localizations_lv.dart';
import 'app_localizations_mk.dart';
import 'app_localizations_ml.dart';
import 'app_localizations_mn.dart';
import 'app_localizations_mr.dart';
import 'app_localizations_ms.dart';
import 'app_localizations_my.dart';
import 'app_localizations_nb.dart';
import 'app_localizations_ne.dart';
import 'app_localizations_nl.dart';
import 'app_localizations_pa.dart';
import 'app_localizations_pl.dart';
import 'app_localizations_pt.dart';
import 'app_localizations_ro.dart';
import 'app_localizations_ru.dart';
import 'app_localizations_si.dart';
import 'app_localizations_sk.dart';
import 'app_localizations_sl.dart';
import 'app_localizations_sq.dart';
import 'app_localizations_sr.dart';
import 'app_localizations_sv.dart';
import 'app_localizations_sw.dart';
import 'app_localizations_ta.dart';
import 'app_localizations_te.dart';
import 'app_localizations_th.dart';
import 'app_localizations_tl.dart';
import 'app_localizations_tr.dart';
import 'app_localizations_uk.dart';
import 'app_localizations_ur.dart';
import 'app_localizations_vi.dart';
import 'app_localizations_zh.dart';
import 'app_localizations_zu.dart';

/// Callers can lookup localized strings with an instance of AppLocalizations
/// returned by `AppLocalizations.of(context)`.
///
/// Applications need to include `AppLocalizations.delegate()` in their app's
/// `localizationDelegates` list, and the locales they support in the app's
/// `supportedLocales` list. For example:
///
/// ```dart
/// import 'generated/app_localizations.dart';
///
/// return MaterialApp(
///   localizationsDelegates: AppLocalizations.localizationsDelegates,
///   supportedLocales: AppLocalizations.supportedLocales,
///   home: MyApplicationHome(),
/// );
/// ```
///
/// ## Update pubspec.yaml
///
/// Please make sure to update your pubspec.yaml to include the following
/// packages:
///
/// ```yaml
/// dependencies:
///   # Internationalization support.
///   flutter_localizations:
///     sdk: flutter
///   intl: any # Use the pinned version from flutter_localizations
///
///   # Rest of dependencies
/// ```
///
/// ## iOS Applications
///
/// iOS applications define key application metadata, including supported
/// locales, in an Info.plist file that is built into the application bundle.
/// To configure the locales supported by your app, you’ll need to edit this
/// file.
///
/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
/// Then, in the Project Navigator, open the Info.plist file under the Runner
/// project’s Runner folder.
///
/// Next, select the Information Property List item, select Add Item from the
/// Editor menu, then select Localizations from the pop-up menu.
///
/// Select and expand the newly-created Localizations item then, for each
/// locale your application supports, add a new item and select the locale
/// you wish to add from the pop-up menu in the Value field. This list should
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
/// property.
abstract class AppLocalizations {
  AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());

  final String localeName;

  static AppLocalizations? of(BuildContext context) {
    return Localizations.of<AppLocalizations>(context, AppLocalizations);
  }

  static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();

  /// A list of this localizations delegate along with the default localizations
  /// delegates.
  ///
  /// Returns a list of localizations delegates containing this delegate along with
  /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
  /// and GlobalWidgetsLocalizations.delegate.
  ///
  /// Additional delegates can be added by appending to this list in
  /// MaterialApp. This list does not have to be used at all if a custom list
  /// of delegates is preferred or required.
  static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
    delegate,
    GlobalMaterialLocalizations.delegate,
    GlobalCupertinoLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate,
  ];

  /// A list of this localizations delegate's supported locales.
  static const List<Locale> supportedLocales = <Locale>[
    Locale('af'),
    Locale('am'),
    Locale('ar'),
    Locale('az'),
    Locale('az', 'AZ'),
    Locale('be'),
    Locale('bg'),
    Locale('bn'),
    Locale('bn', 'BD'),
    Locale('ca'),
    Locale('cs'),
    Locale('cs', 'CZ'),
    Locale('da'),
    Locale('da', 'DK'),
    Locale('de'),
    Locale('de', 'DE'),
    Locale('el'),
    Locale('el', 'GR'),
    Locale('en'),
    Locale('es'),
    Locale('es', '419'),
    Locale('es', 'ES'),
    Locale('es', 'US'),
    Locale('et'),
    Locale('eu'),
    Locale('eu', 'ES'),
    Locale('fa'),
    Locale('fi'),
    Locale('fi', 'FI'),
    Locale('fil'),
    Locale('fr'),
    Locale('fr', 'CA'),
    Locale('fr', 'FR'),
    Locale('gl'),
    Locale('gl', 'ES'),
    Locale('gu'),
    Locale('he'),
    Locale('he', 'IL'),
    Locale('hi'),
    Locale('hi', 'IN'),
    Locale('hr'),
    Locale('hu'),
    Locale('hu', 'HU'),
    Locale('hy'),
    Locale('hy', 'AM'),
    Locale('id'),
    Locale('is'),
    Locale('is', 'IS'),
    Locale('it'),
    Locale('it', 'IT'),
    Locale('ja'),
    Locale('ja', 'JP'),
    Locale('ka'),
    Locale('ka', 'GE'),
    Locale('kk'),
    Locale('km'),
    Locale('km', 'KH'),
    Locale('kn'),
    Locale('kn', 'IN'),
    Locale('ko'),
    Locale('ko', 'KR'),
    Locale('ky'),
    Locale('ky', 'KG'),
    Locale('lo'),
    Locale('lo', 'LA'),
    Locale('lt'),
    Locale('lv'),
    Locale('mk'),
    Locale('mk', 'MK'),
    Locale('ml'),
    Locale('ml', 'IN'),
    Locale('mn'),
    Locale('mn', 'MN'),
    Locale('mr'),
    Locale('mr', 'IN'),
    Locale('ms'),
    Locale('ms', 'MY'),
    Locale('my'),
    Locale('my', 'MM'),
    Locale('nb'),
    Locale('nb', 'NO'),
    Locale('ne'),
    Locale('ne', 'NP'),
    Locale('nl'),
    Locale('nl', 'NL'),
    Locale('pa'),
    Locale('pl'),
    Locale('pl', 'PL'),
    Locale('pt'),
    Locale('pt', 'BR'),
    Locale('pt', 'PT'),
    Locale('ro'),
    Locale('ru'),
    Locale('ru', 'RU'),
    Locale('si'),
    Locale('si', 'LK'),
    Locale('sk'),
    Locale('sl'),
    Locale('sq'),
    Locale('sr'),
    Locale('sv'),
    Locale('sv', 'SE'),
    Locale('sw'),
    Locale('ta'),
    Locale('ta', 'IN'),
    Locale('te'),
    Locale('te', 'IN'),
    Locale('th'),
    Locale('tl'),
    Locale('tr'),
    Locale('tr', 'TR'),
    Locale('uk'),
    Locale('ur'),
    Locale('vi'),
    Locale('zh'),
    Locale('zh', 'CN'),
    Locale('zh', 'HK'),
    Locale('zh', 'TW'),
    Locale('zu')
  ];

  /// No description provided for @play.
  ///
  /// In en, this message translates to:
  /// **'Play'**
  String get play;

  /// No description provided for @replay.
  ///
  /// In en, this message translates to:
  /// **'Replay'**
  String get replay;

  /// No description provided for @collect.
  ///
  /// In en, this message translates to:
  /// **'Collect'**
  String get collect;

  /// No description provided for @congratulations.
  ///
  /// In en, this message translates to:
  /// **'Congratulations!'**
  String get congratulations;

  /// No description provided for @congratsSummary.
  ///
  /// In en, this message translates to:
  /// **'You have completed all Daily Challenges for {MMMMy} and earned gold trophy!'**
  String congratsSummary(String MMMMy);
}

class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
  const _AppLocalizationsDelegate();

  @override
  Future<AppLocalizations> load(Locale locale) {
    return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
  }

  @override
  bool isSupported(Locale locale) => <String>['af', 'am', 'ar', 'az', 'be', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en', 'es', 'et', 'eu', 'fa', 'fi', 'fil', 'fr', 'gl', 'gu', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kk', 'km', 'kn', 'ko', 'ky', 'lo', 'lt', 'lv', 'mk', 'ml', 'mn', 'mr', 'ms', 'my', 'nb', 'ne', 'nl', 'pa', 'pl', 'pt', 'ro', 'ru', 'si', 'sk', 'sl', 'sq', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tl', 'tr', 'uk', 'ur', 'vi', 'zh', 'zu'].contains(locale.languageCode);

  @override
  bool shouldReload(_AppLocalizationsDelegate old) => false;
}

AppLocalizations lookupAppLocalizations(Locale locale) {

  // Lookup logic when language+country codes are specified.
  switch (locale.languageCode) {
    case 'az': {
  switch (locale.countryCode) {
    case 'AZ': return AppLocalizationsAzAz();
   }
  break;
   }
    case 'bn': {
  switch (locale.countryCode) {
    case 'BD': return AppLocalizationsBnBd();
   }
  break;
   }
    case 'cs': {
  switch (locale.countryCode) {
    case 'CZ': return AppLocalizationsCsCz();
   }
  break;
   }
    case 'da': {
  switch (locale.countryCode) {
    case 'DK': return AppLocalizationsDaDk();
   }
  break;
   }
    case 'de': {
  switch (locale.countryCode) {
    case 'DE': return AppLocalizationsDeDe();
   }
  break;
   }
    case 'el': {
  switch (locale.countryCode) {
    case 'GR': return AppLocalizationsElGr();
   }
  break;
   }
    case 'es': {
  switch (locale.countryCode) {
    case '419': return AppLocalizationsEs419();
case 'ES': return AppLocalizationsEsEs();
case 'US': return AppLocalizationsEsUs();
   }
  break;
   }
    case 'eu': {
  switch (locale.countryCode) {
    case 'ES': return AppLocalizationsEuEs();
   }
  break;
   }
    case 'fi': {
  switch (locale.countryCode) {
    case 'FI': return AppLocalizationsFiFi();
   }
  break;
   }
    case 'fr': {
  switch (locale.countryCode) {
    case 'CA': return AppLocalizationsFrCa();
case 'FR': return AppLocalizationsFrFr();
   }
  break;
   }
    case 'gl': {
  switch (locale.countryCode) {
    case 'ES': return AppLocalizationsGlEs();
   }
  break;
   }
    case 'he': {
  switch (locale.countryCode) {
    case 'IL': return AppLocalizationsHeIl();
   }
  break;
   }
    case 'hi': {
  switch (locale.countryCode) {
    case 'IN': return AppLocalizationsHiIn();
   }
  break;
   }
    case 'hu': {
  switch (locale.countryCode) {
    case 'HU': return AppLocalizationsHuHu();
   }
  break;
   }
    case 'hy': {
  switch (locale.countryCode) {
    case 'AM': return AppLocalizationsHyAm();
   }
  break;
   }
    case 'is': {
  switch (locale.countryCode) {
    case 'IS': return AppLocalizationsIsIs();
   }
  break;
   }
    case 'it': {
  switch (locale.countryCode) {
    case 'IT': return AppLocalizationsItIt();
   }
  break;
   }
    case 'ja': {
  switch (locale.countryCode) {
    case 'JP': return AppLocalizationsJaJp();
   }
  break;
   }
    case 'ka': {
  switch (locale.countryCode) {
    case 'GE': return AppLocalizationsKaGe();
   }
  break;
   }
    case 'km': {
  switch (locale.countryCode) {
    case 'KH': return AppLocalizationsKmKh();
   }
  break;
   }
    case 'kn': {
  switch (locale.countryCode) {
    case 'IN': return AppLocalizationsKnIn();
   }
  break;
   }
    case 'ko': {
  switch (locale.countryCode) {
    case 'KR': return AppLocalizationsKoKr();
   }
  break;
   }
    case 'ky': {
  switch (locale.countryCode) {
    case 'KG': return AppLocalizationsKyKg();
   }
  break;
   }
    case 'lo': {
  switch (locale.countryCode) {
    case 'LA': return AppLocalizationsLoLa();
   }
  break;
   }
    case 'mk': {
  switch (locale.countryCode) {
    case 'MK': return AppLocalizationsMkMk();
   }
  break;
   }
    case 'ml': {
  switch (locale.countryCode) {
    case 'IN': return AppLocalizationsMlIn();
   }
  break;
   }
    case 'mn': {
  switch (locale.countryCode) {
    case 'MN': return AppLocalizationsMnMn();
   }
  break;
   }
    case 'mr': {
  switch (locale.countryCode) {
    case 'IN': return AppLocalizationsMrIn();
   }
  break;
   }
    case 'ms': {
  switch (locale.countryCode) {
    case 'MY': return AppLocalizationsMsMy();
   }
  break;
   }
    case 'my': {
  switch (locale.countryCode) {
    case 'MM': return AppLocalizationsMyMm();
   }
  break;
   }
    case 'nb': {
  switch (locale.countryCode) {
    case 'NO': return AppLocalizationsNbNo();
   }
  break;
   }
    case 'ne': {
  switch (locale.countryCode) {
    case 'NP': return AppLocalizationsNeNp();
   }
  break;
   }
    case 'nl': {
  switch (locale.countryCode) {
    case 'NL': return AppLocalizationsNlNl();
   }
  break;
   }
    case 'pl': {
  switch (locale.countryCode) {
    case 'PL': return AppLocalizationsPlPl();
   }
  break;
   }
    case 'pt': {
  switch (locale.countryCode) {
    case 'BR': return AppLocalizationsPtBr();
case 'PT': return AppLocalizationsPtPt();
   }
  break;
   }
    case 'ru': {
  switch (locale.countryCode) {
    case 'RU': return AppLocalizationsRuRu();
   }
  break;
   }
    case 'si': {
  switch (locale.countryCode) {
    case 'LK': return AppLocalizationsSiLk();
   }
  break;
   }
    case 'sv': {
  switch (locale.countryCode) {
    case 'SE': return AppLocalizationsSvSe();
   }
  break;
   }
    case 'ta': {
  switch (locale.countryCode) {
    case 'IN': return AppLocalizationsTaIn();
   }
  break;
   }
    case 'te': {
  switch (locale.countryCode) {
    case 'IN': return AppLocalizationsTeIn();
   }
  break;
   }
    case 'tr': {
  switch (locale.countryCode) {
    case 'TR': return AppLocalizationsTrTr();
   }
  break;
   }
    case 'zh': {
  switch (locale.countryCode) {
    case 'CN': return AppLocalizationsZhCn();
case 'HK': return AppLocalizationsZhHk();
case 'TW': return AppLocalizationsZhTw();
   }
  break;
   }
  }

  // Lookup logic when only language code is specified.
  switch (locale.languageCode) {
    case 'af': return AppLocalizationsAf();
    case 'am': return AppLocalizationsAm();
    case 'ar': return AppLocalizationsAr();
    case 'az': return AppLocalizationsAz();
    case 'be': return AppLocalizationsBe();
    case 'bg': return AppLocalizationsBg();
    case 'bn': return AppLocalizationsBn();
    case 'ca': return AppLocalizationsCa();
    case 'cs': return AppLocalizationsCs();
    case 'da': return AppLocalizationsDa();
    case 'de': return AppLocalizationsDe();
    case 'el': return AppLocalizationsEl();
    case 'en': return AppLocalizationsEn();
    case 'es': return AppLocalizationsEs();
    case 'et': return AppLocalizationsEt();
    case 'eu': return AppLocalizationsEu();
    case 'fa': return AppLocalizationsFa();
    case 'fi': return AppLocalizationsFi();
    case 'fil': return AppLocalizationsFil();
    case 'fr': return AppLocalizationsFr();
    case 'gl': return AppLocalizationsGl();
    case 'gu': return AppLocalizationsGu();
    case 'he': return AppLocalizationsHe();
    case 'hi': return AppLocalizationsHi();
    case 'hr': return AppLocalizationsHr();
    case 'hu': return AppLocalizationsHu();
    case 'hy': return AppLocalizationsHy();
    case 'id': return AppLocalizationsId();
    case 'is': return AppLocalizationsIs();
    case 'it': return AppLocalizationsIt();
    case 'ja': return AppLocalizationsJa();
    case 'ka': return AppLocalizationsKa();
    case 'kk': return AppLocalizationsKk();
    case 'km': return AppLocalizationsKm();
    case 'kn': return AppLocalizationsKn();
    case 'ko': return AppLocalizationsKo();
    case 'ky': return AppLocalizationsKy();
    case 'lo': return AppLocalizationsLo();
    case 'lt': return AppLocalizationsLt();
    case 'lv': return AppLocalizationsLv();
    case 'mk': return AppLocalizationsMk();
    case 'ml': return AppLocalizationsMl();
    case 'mn': return AppLocalizationsMn();
    case 'mr': return AppLocalizationsMr();
    case 'ms': return AppLocalizationsMs();
    case 'my': return AppLocalizationsMy();
    case 'nb': return AppLocalizationsNb();
    case 'ne': return AppLocalizationsNe();
    case 'nl': return AppLocalizationsNl();
    case 'pa': return AppLocalizationsPa();
    case 'pl': return AppLocalizationsPl();
    case 'pt': return AppLocalizationsPt();
    case 'ro': return AppLocalizationsRo();
    case 'ru': return AppLocalizationsRu();
    case 'si': return AppLocalizationsSi();
    case 'sk': return AppLocalizationsSk();
    case 'sl': return AppLocalizationsSl();
    case 'sq': return AppLocalizationsSq();
    case 'sr': return AppLocalizationsSr();
    case 'sv': return AppLocalizationsSv();
    case 'sw': return AppLocalizationsSw();
    case 'ta': return AppLocalizationsTa();
    case 'te': return AppLocalizationsTe();
    case 'th': return AppLocalizationsTh();
    case 'tl': return AppLocalizationsTl();
    case 'tr': return AppLocalizationsTr();
    case 'uk': return AppLocalizationsUk();
    case 'ur': return AppLocalizationsUr();
    case 'vi': return AppLocalizationsVi();
    case 'zh': return AppLocalizationsZh();
    case 'zu': return AppLocalizationsZu();
  }

  throw FlutterError(
    'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
    'an issue with the localizations generation tool. Please file an issue '
    'on GitHub with a reproducible sample app and the gen-l10n configuration '
    'that was used.'
  );
}
