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_ar.dart';
import 'app_localizations_de.dart';
import 'app_localizations_en.dart';
import 'app_localizations_es.dart';
import 'app_localizations_fr.dart';
import 'app_localizations_ja.dart';
import 'app_localizations_ko.dart';
import 'app_localizations_pt.dart';
import 'app_localizations_ru.dart';
import 'app_localizations_zh.dart';

// ignore_for_file: type=lint

/// 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 'l10n/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('ar'),
    Locale('de'),
    Locale('en'),
    Locale('es'),
    Locale('fr'),
    Locale('ja'),
    Locale('ko'),
    Locale('pt'),
    Locale('ru'),
    Locale('zh'),
    Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans'),
    Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'),
    Locale.fromSubtags(languageCode: 'zh', countryCode: 'HK', scriptCode: 'Hant'),
    Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW', scriptCode: 'Hant')
  ];

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  /// No description provided for @shadowWhenDraging.
  ///
  /// In en, this message translates to:
  /// **'Shadow when draging'**
  String get shadowWhenDraging;

  /// No description provided for @showColorPics.
  ///
  /// In en, this message translates to:
  /// **'Show Color Pics'**
  String get showColorPics;

  /// No description provided for @hideCompleted.
  ///
  /// In en, this message translates to:
  /// **'Hide completed images'**
  String get hideCompleted;

  /// No description provided for @giveMeAReview.
  ///
  /// In en, this message translates to:
  /// **'Give me a review'**
  String get giveMeAReview;

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

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

  /// No description provided for @termOfService.
  ///
  /// In en, this message translates to:
  /// **'Term of Service'**
  String get termOfService;

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

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

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

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

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

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

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

  /// No description provided for @removeWatermark.
  ///
  /// In en, this message translates to:
  /// **'Easily remove watermark'**
  String get removeWatermark;

  /// No description provided for @onlyOneAd.
  ///
  /// In en, this message translates to:
  /// **'Just one AD to go ~'**
  String get onlyOneAd;

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

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

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

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

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

  /// No description provided for @adNotReady.
  ///
  /// In en, this message translates to:
  /// **'Ad wasn\'t ready yet.'**
  String get adNotReady;

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

  /// No description provided for @networkNotGood.
  ///
  /// In en, this message translates to:
  /// **'Network condition is poor, please check'**
  String get networkNotGood;

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

  /// No description provided for @rateMessage.
  ///
  /// In en, this message translates to:
  /// **'Your support is the power to drive our continuous improvement.'**
  String get rateMessage;

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

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

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

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

  /// No description provided for @alreadyCompleted.
  ///
  /// In en, this message translates to:
  /// **'You have completed'**
  String get alreadyCompleted;

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

  /// No description provided for @notEnoughCoins.
  ///
  /// In en, this message translates to:
  /// **'Coins not enough'**
  String get notEnoughCoins;

  /// No description provided for @lackCoins.
  ///
  /// In en, this message translates to:
  /// **'Not enough coins to unlock this puzzle'**
  String get lackCoins;

  /// No description provided for @lackCoinsToUnlockCollection.
  ///
  /// In en, this message translates to:
  /// **'Not enough coins to unlock this collection'**
  String get lackCoinsToUnlockCollection;

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

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

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

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

  /// No description provided for @getThisPuzzle.
  ///
  /// In en, this message translates to:
  /// **'Get This Puzzle'**
  String get getThisPuzzle;

  /// No description provided for @getThisCollection.
  ///
  /// In en, this message translates to:
  /// **'Get This Collection'**
  String get getThisCollection;

  /// No description provided for @watch1Video.
  ///
  /// In en, this message translates to:
  /// **'Watch 1 video'**
  String get watch1Video;

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

  /// No description provided for @unlockAllWith.
  ///
  /// In en, this message translates to:
  /// **'Unlock all with'**
  String get unlockAllWith;

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

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

  /// No description provided for @unlockCollections.
  ///
  /// In en, this message translates to:
  /// **'You must complete 7 levels to unlock the collection'**
  String get unlockCollections;

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

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

  /// No description provided for @earnFreeCoins.
  ///
  /// In en, this message translates to:
  /// **'Watch a short video to earn free coins.'**
  String get earnFreeCoins;

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

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

  /// No description provided for @welcomBackDesc.
  ///
  /// In en, this message translates to:
  /// **'Get free hints to make your puzzles mush easier'**
  String get welcomBackDesc;

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

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

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

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

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

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

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

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

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

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

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

  /// No description provided for @workWillDelete.
  ///
  /// In en, this message translates to:
  /// **'Current saved work will be deleted'**
  String get workWillDelete;

  /// No description provided for @sureToRestart.
  ///
  /// In en, this message translates to:
  /// **'Are you sure to restart this puzzle?'**
  String get sureToRestart;

  /// No description provided for @sureToDelete.
  ///
  /// In en, this message translates to:
  /// **'Are you sure to delete this puzzle?'**
  String get sureToDelete;

  /// No description provided for @lostCurrentProgress.
  ///
  /// In en, this message translates to:
  /// **'The current saved progress will be lost'**
  String get lostCurrentProgress;

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

  /// No description provided for @removeAllAds.
  ///
  /// In en, this message translates to:
  /// **'Remove banners and popup ads. (Keep ads for rewards)'**
  String get removeAllAds;

  /// No description provided for @unlockVideoPics.
  ///
  /// In en, this message translates to:
  /// **'Unlock all locked pics (excluding collection packs)'**
  String get unlockVideoPics;

  /// No description provided for @premiumAlbumPrice.
  ///
  /// In en, this message translates to:
  /// **'60% off album package'**
  String get premiumAlbumPrice;

  /// No description provided for @premiumDailyReward.
  ///
  /// In en, this message translates to:
  /// **'Daily reward of 300 gold coins and 5 hints'**
  String get premiumDailyReward;

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

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

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

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

  /// No description provided for @free3day.
  ///
  /// In en, this message translates to:
  /// **'3-day free trial, then \$9.99/month'**
  String get free3day;

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

  /// No description provided for @successSubsribe.
  ///
  /// In en, this message translates to:
  /// **'You have successfully subscribed'**
  String get successSubsribe;

  /// No description provided for @subscriptionDescription.
  ///
  /// In en, this message translates to:
  /// **'You can manage and cancel subscriptions at any time in the App Store. When you cancel a subscription, the current billing cycle will not be refunded, but you will continue to receive the subscribed content during that time. The cancellation will take effect after the current billing cycle ends.'**
  String get subscriptionDescription;

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

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

  /// No description provided for @premiumRewards.
  ///
  /// In en, this message translates to:
  /// **'Claim exclusive rewards today'**
  String get premiumRewards;

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

  /// No description provided for @useForHint.
  ///
  /// In en, this message translates to:
  /// **'Use it for hint'**
  String get useForHint;

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

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

  /// No description provided for @no_trophies_yet.
  ///
  /// In en, this message translates to:
  /// **'You don\'t have any trophies yet.'**
  String get no_trophies_yet;

  /// No description provided for @to_win_trophy.
  ///
  /// In en, this message translates to:
  /// **'Participate in the event and win a unique trophy!'**
  String get to_win_trophy;

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

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

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

  /// No description provided for @addMorePuzzlesSoon.
  ///
  /// In en, this message translates to:
  /// **'We will add more puzzles soon'**
  String get addMorePuzzlesSoon;

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

  /// No description provided for @unlockAlbum.
  ///
  /// In en, this message translates to:
  /// **'You\'ve unlocked the'**
  String get unlockAlbum;

  /// No description provided for @completePrevious.
  ///
  /// In en, this message translates to:
  /// **'Please complete the previous levels first.'**
  String get completePrevious;

  /// No description provided for @exitConfirm.
  ///
  /// In en, this message translates to:
  /// **'Press the back button again to exit the app.'**
  String get exitConfirm;

  /// No description provided for @downloadFailed.
  ///
  /// In en, this message translates to:
  /// **'Download Failed! Please check your network.'**
  String get downloadFailed;

  /// No description provided for @noMorePicture.
  ///
  /// In en, this message translates to:
  /// **'More pictures coming soon...'**
  String get noMorePicture;

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

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

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

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

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

  /// No description provided for @moveToComplete.
  ///
  /// In en, this message translates to:
  /// **'Move pieces to complete the puzzle'**
  String get moveToComplete;

  /// No description provided for @collectionLocked.
  ///
  /// In en, this message translates to:
  /// **'This collectible image is not yet unlocked.'**
  String get collectionLocked;
}

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

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

  @override
  bool isSupported(Locale locale) => <String>['ar', 'de', 'en', 'es', 'fr', 'ja', 'ko', 'pt', 'ru', 'zh'].contains(locale.languageCode);

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

AppLocalizations lookupAppLocalizations(Locale locale) {
    // Lookup logic when language+script+country codes are specified.
  switch (locale.toString()) {
    case 'zh_Hant_HK': return AppLocalizationsZhHantHk();
        case 'zh_Hant_TW': return AppLocalizationsZhHantTw();
  }

  // Lookup logic when language+script codes are specified.
  switch (locale.languageCode) {
    case 'zh': {
  switch (locale.scriptCode) {
    case 'Hans': return AppLocalizationsZhHans();
case 'Hant': return AppLocalizationsZhHant();
   }
  break;
   }
  }

  // Lookup logic when only language code is specified.
  switch (locale.languageCode) {
    case 'ar': return AppLocalizationsAr();
    case 'de': return AppLocalizationsDe();
    case 'en': return AppLocalizationsEn();
    case 'es': return AppLocalizationsEs();
    case 'fr': return AppLocalizationsFr();
    case 'ja': return AppLocalizationsJa();
    case 'ko': return AppLocalizationsKo();
    case 'pt': return AppLocalizationsPt();
    case 'ru': return AppLocalizationsRu();
    case 'zh': return AppLocalizationsZh();
  }

  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.'
  );
}
