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_en.dart'; import 'app_localizations_es.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 'gen/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(context, AppLocalizations)!; } static const LocalizationsDelegate 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> localizationsDelegates = >[ delegate, GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, GlobalWidgetsLocalizations.delegate, ]; /// A list of this localizations delegate's supported locales. static const List supportedLocales = [ Locale('en'), Locale('es'), ]; /// No description provided for @appTitle. /// /// In es, this message translates to: /// **'PluriWave'** String get appTitle; /// No description provided for @navHome. /// /// In es, this message translates to: /// **'Inicio'** String get navHome; /// No description provided for @navSearch. /// /// In es, this message translates to: /// **'Buscar'** String get navSearch; /// No description provided for @navFavorites. /// /// In es, this message translates to: /// **'Favoritos'** String get navFavorites; /// No description provided for @navAlarms. /// /// In es, this message translates to: /// **'Alarmas'** String get navAlarms; /// No description provided for @navSettings. /// /// In es, this message translates to: /// **'Ajustes'** String get navSettings; /// No description provided for @actionOk. /// /// In es, this message translates to: /// **'OK'** String get actionOk; /// No description provided for @sleepTimer. /// /// In es, this message translates to: /// **'Timer de sueño'** String get sleepTimer; /// No description provided for @sleepTimerDescription. /// /// In es, this message translates to: /// **'Apagado suave de la radio con cuenta atrás exacta.'** String get sleepTimerDescription; /// No description provided for @cancelTimer. /// /// In es, this message translates to: /// **'Cancelar timer'** String get cancelTimer; /// No description provided for @optionOther. /// /// In es, this message translates to: /// **'Otro'** String get optionOther; /// No description provided for @customDurationTitle. /// /// In es, this message translates to: /// **'Duración personalizada'** String get customDurationTitle; /// No description provided for @durationGreaterThanZero. /// /// In es, this message translates to: /// **'Elegí una duración mayor que cero.'** String get durationGreaterThanZero; /// No description provided for @hoursLabel. /// /// In es, this message translates to: /// **'Horas'** String get hoursLabel; /// No description provided for @minutesLabel. /// /// In es, this message translates to: /// **'Minutos'** String get minutesLabel; /// No description provided for @secondsLabel. /// /// In es, this message translates to: /// **'Segundos'** String get secondsLabel; /// No description provided for @saveQuickAccess. /// /// In es, this message translates to: /// **'Guardar como acceso rápido'** String get saveQuickAccess; /// No description provided for @startTimer. /// /// In es, this message translates to: /// **'Iniciar timer'** String get startTimer; /// No description provided for @skipCurrentAlarmExecution. /// /// In es, this message translates to: /// **'Omitida esta ejecución de {alarmName}.'** String skipCurrentAlarmExecution(Object alarmName); /// No description provided for @settingsTitle. /// /// In es, this message translates to: /// **'Ajustes'** String get settingsTitle; /// No description provided for @settingsSubtitle. /// /// In es, this message translates to: /// **'Control fino de sonido, copias de seguridad y emisoras personalizadas.'** String get settingsSubtitle; /// No description provided for @languageSectionTitle. /// /// In es, this message translates to: /// **'Idioma'** String get languageSectionTitle; /// No description provided for @languageSectionDescription. /// /// In es, this message translates to: /// **'Elegí cómo se muestra el idioma de la app.'** String get languageSectionDescription; /// No description provided for @languageSystemDefault. /// /// In es, this message translates to: /// **'Sistema'** String get languageSystemDefault; /// No description provided for @languageSpanish. /// /// In es, this message translates to: /// **'Español'** String get languageSpanish; /// No description provided for @languageEnglish. /// /// In es, this message translates to: /// **'Inglés'** String get languageEnglish; /// No description provided for @languageUpdated. /// /// In es, this message translates to: /// **'Idioma actualizado: {languageName}'** String languageUpdated(Object languageName); /// No description provided for @languageUpdatedSystem. /// /// In es, this message translates to: /// **'Idioma actualizado: Sistema'** String get languageUpdatedSystem; /// No description provided for @timerSectionTitle. /// /// In es, this message translates to: /// **'Timer de sueño'** String get timerSectionTitle; /// No description provided for @timerSectionAdd. /// /// In es, this message translates to: /// **'Añadir'** String get timerSectionAdd; /// No description provided for @timerSectionDescription. /// /// In es, this message translates to: /// **'Personalizá los accesos rápidos que aparecen al apagar la radio automáticamente.'** String get timerSectionDescription; /// No description provided for @timerSectionRestoreRecommended. /// /// In es, this message translates to: /// **'Restaurar tiempos recomendados'** String get timerSectionRestoreRecommended; /// No description provided for @newQuickAccessTitle. /// /// In es, this message translates to: /// **'Nuevo acceso rápido'** String get newQuickAccessTitle; /// No description provided for @saveQuickAccessButton. /// /// In es, this message translates to: /// **'Guardar acceso rápido'** String get saveQuickAccessButton; } class _AppLocalizationsDelegate extends LocalizationsDelegate { const _AppLocalizationsDelegate(); @override Future load(Locale locale) { return SynchronousFuture(lookupAppLocalizations(locale)); } @override bool isSupported(Locale locale) => ['en', 'es'].contains(locale.languageCode); @override bool shouldReload(_AppLocalizationsDelegate old) => false; } AppLocalizations lookupAppLocalizations(Locale locale) { // Lookup logic when only language code is specified. switch (locale.languageCode) { case 'en': return AppLocalizationsEn(); case 'es': return AppLocalizationsEs(); } 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.', ); }