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_fr.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(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('fr'), ]; /// No description provided for @addPhoto. /// /// In en, this message translates to: /// **'Add photo'** String get addPhoto; /// No description provided for @anomaly. /// /// In en, this message translates to: /// **'Anomaly'** String get anomaly; /// No description provided for @anomalyBadHandlingUnit. /// /// In en, this message translates to: /// **'Declined - Package in bad condition'** String get anomalyBadHandlingUnit; /// No description provided for @anomalyCustomerRefused. /// /// In en, this message translates to: /// **'Declined - Customer declined'** String get anomalyCustomerRefused; /// No description provided for @anomalyCustomerUnavailable. /// /// In en, this message translates to: /// **'Unavailable - Customer unavailable'** String get anomalyCustomerUnavailable; /// No description provided for @anomalyOther. /// /// In en, this message translates to: /// **'Other reason'** String get anomalyOther; /// No description provided for @anomalyReason. /// /// In en, this message translates to: /// **'Anomaly reason'** String get anomalyReason; /// No description provided for @cancel. /// /// In en, this message translates to: /// **'Cancel'** String get cancel; /// No description provided for @cannotNotifyDelivery. /// /// In en, this message translates to: /// **'Cannot notify delivery'** String get cannotNotifyDelivery; /// No description provided for @copied. /// /// In en, this message translates to: /// **'copied'** String get copied; /// No description provided for @dateOn. /// /// In en, this message translates to: /// **'the {date} at {time}'** String dateOn(DateTime date, DateTime time); /// No description provided for @deliveryOk. /// /// In en, this message translates to: /// **'Delivery notified as OK'** String get deliveryOk; /// No description provided for @deliveryWithAnomaly. /// /// In en, this message translates to: /// **'Delivery notified with anomaly'** String get deliveryWithAnomaly; /// No description provided for @dimensions. /// /// In en, this message translates to: /// **'Dimensions (H x W x L)'** String get dimensions; /// No description provided for @error. /// /// In en, this message translates to: /// **'Error'** String get error; /// No description provided for @handlingUnitIdentifier. /// /// In en, this message translates to: /// **'Handling unit Identifier'** String get handlingUnitIdentifier; /// No description provided for @handlingUnitType. /// /// In en, this message translates to: /// **'Handling unit type'** String get handlingUnitType; /// No description provided for @informations. /// /// In en, this message translates to: /// **'Informations'** String get informations; /// No description provided for @items. /// /// In en, this message translates to: /// **'Items'** String get items; /// No description provided for @itemId. /// /// In en, this message translates to: /// **'Item ID'** String get itemId; /// No description provided for @missingSendingFilesRights. /// /// In en, this message translates to: /// **'You are not allowed to send files in this project'** String get missingSendingFilesRights; /// No description provided for @nextDelivery. /// /// In en, this message translates to: /// **'Next delivery'** String get nextDelivery; /// No description provided for @noHandlingUnitFound. /// /// In en, this message translates to: /// **'No handling unit found'** String get noHandlingUnitFound; /// No description provided for @ok. /// /// In en, this message translates to: /// **'OK'** String get ok; /// No description provided for @or. /// /// In en, this message translates to: /// **'OR'** String get or; /// No description provided for @organization. /// /// In en, this message translates to: /// **'Organization'** String get organization; /// No description provided for @pleaseTryAgain. /// /// In en, this message translates to: /// **'Please try again'** String get pleaseTryAgain; /// No description provided for @pleaseIndicateAnomaly. /// /// In en, this message translates to: /// **'Please indicate if the handling unit has an anomaly or not'** String get pleaseIndicateAnomaly; /// No description provided for @project. /// /// In en, this message translates to: /// **'Project'** String get project; /// No description provided for @quantity. /// /// In en, this message translates to: /// **'Quantity'** String get quantity; /// No description provided for @scanBarcode. /// /// In en, this message translates to: /// **'SCAN BARCODE'** String get scanBarcode; /// No description provided for @search. /// /// In en, this message translates to: /// **'Search'** String get search; /// No description provided for @selectContext. /// /// In en, this message translates to: /// **'Select the desired organization and project of your delivery'** String get selectContext; /// No description provided for @selectHandlingUnit. /// /// In en, this message translates to: /// **'Select a handling unit by typing or scanning its identifier'** String get selectHandlingUnit; /// No description provided for @signature. /// /// In en, this message translates to: /// **'Signature'** String get signature; /// No description provided for @start. /// /// In en, this message translates to: /// **'Start tour'** String get start; /// No description provided for @tryAgain. /// /// In en, this message translates to: /// **'Try again'** String get tryAgain; /// No description provided for @trackingNumber. /// /// In en, this message translates to: /// **'Tracking N°'** String get trackingNumber; /// No description provided for @validDelivery. /// /// In en, this message translates to: /// **'OK'** String get validDelivery; /// No description provided for @weight. /// /// In en, this message translates to: /// **'Weight'** String get weight; } class _AppLocalizationsDelegate extends LocalizationsDelegate { const _AppLocalizationsDelegate(); @override Future load(Locale locale) { return SynchronousFuture(lookupAppLocalizations(locale)); } @override bool isSupported(Locale locale) => ['en', 'fr'].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 'fr': return AppLocalizationsFr(); } 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.', ); }