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_ru.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('ru'), ]; /// No description provided for @appTitle. /// /// In en, this message translates to: /// **'Budget App'** String get appTitle; /// No description provided for @homePageTitle. /// /// In en, this message translates to: /// **'Home'** String get homePageTitle; /// No description provided for @reportsPageTitle. /// /// In en, this message translates to: /// **'Reports'** String get reportsPageTitle; /// No description provided for @settingsPageTitle. /// /// In en, this message translates to: /// **'Settings'** String get settingsPageTitle; /// No description provided for @addTransactionButton. /// /// In en, this message translates to: /// **'Add new transaction'** String get addTransactionButton; /// No description provided for @noTransactionsText. /// /// In en, this message translates to: /// **'No transactions yet'** String get noTransactionsText; /// No description provided for @loadingTransactionsText. /// /// In en, this message translates to: /// **'Loading transactions...'** String get loadingTransactionsText; /// No description provided for @transactionErrorText. /// /// In en, this message translates to: /// **'Error: {message}'** String transactionErrorText(Object message); /// No description provided for @loginPageTitle. /// /// In en, this message translates to: /// **'Login'** String get loginPageTitle; /// No description provided for @nameFieldLabel. /// /// In en, this message translates to: /// **'Name'** String get nameFieldLabel; /// No description provided for @emailFieldLabel. /// /// In en, this message translates to: /// **'Email'** String get emailFieldLabel; /// No description provided for @nameFieldEmptyError. /// /// In en, this message translates to: /// **'Please enter your name'** String get nameFieldEmptyError; /// No description provided for @emailFieldEmptyError. /// /// In en, this message translates to: /// **'Please enter your email'** String get emailFieldEmptyError; /// No description provided for @loginButtonText. /// /// In en, this message translates to: /// **'Login / Register'** String get loginButtonText; /// No description provided for @darkModeSetting. /// /// In en, this message translates to: /// **'Dark Theme'** String get darkModeSetting; /// No description provided for @darkModeDescription. /// /// In en, this message translates to: /// **'Toggle between light and dark theme'** String get darkModeDescription; /// No description provided for @languageSetting. /// /// In en, this message translates to: /// **'Language'** String get languageSetting; /// No description provided for @languageDescription. /// /// In en, this message translates to: /// **'Change application language'** String get languageDescription; /// No description provided for @russianLanguage. /// /// In en, this message translates to: /// **'Russian'** String get russianLanguage; /// No description provided for @englishLanguage. /// /// In en, this message translates to: /// **'English'** String get englishLanguage; /// No description provided for @defaultUser. /// /// In en, this message translates to: /// **'Default User'** String get defaultUser; /// No description provided for @currencySetting. /// /// In en, this message translates to: /// **'Default Currency'** String get currencySetting; /// No description provided for @currencyDescription. /// /// In en, this message translates to: /// **'Set the default currency for transactions'** String get currencyDescription; /// No description provided for @transactionsHistoryTitle. /// /// In en, this message translates to: /// **'Transactions History'** String get transactionsHistoryTitle; /// No description provided for @balance. /// /// In en, this message translates to: /// **'Balance'** String get balance; /// No description provided for @income. /// /// In en, this message translates to: /// **'Income'** String get income; /// No description provided for @expense. /// /// In en, this message translates to: /// **'Expense'** String get expense; /// No description provided for @amount. /// /// In en, this message translates to: /// **'Amount'** String get amount; /// No description provided for @vendor. /// /// In en, this message translates to: /// **'Vendor'** String get vendor; /// No description provided for @category. /// /// In en, this message translates to: /// **'Category'** String get category; /// No description provided for @date. /// /// In en, this message translates to: /// **'Date'** String get date; /// No description provided for @requiredField. /// /// In en, this message translates to: /// **'Required field'** String get requiredField; /// No description provided for @invalidNumber. /// /// In en, this message translates to: /// **'Invalid number'** String get invalidNumber; /// No description provided for @cancel. /// /// In en, this message translates to: /// **'Cancel'** String get cancel; /// No description provided for @save. /// /// In en, this message translates to: /// **'Save'** String get save; /// No description provided for @tag. /// /// In en, this message translates to: /// **'Tag'** String get tag; /// No description provided for @icon. /// /// In en, this message translates to: /// **'Icon'** String get icon; /// No description provided for @smsPageTitle. /// /// In en, this message translates to: /// **'SMS Messages'** String get smsPageTitle; /// No description provided for @smsPermissionDenied. /// /// In en, this message translates to: /// **'SMS permission is required'** String get smsPermissionDenied; /// No description provided for @editCategories. /// /// In en, this message translates to: /// **'Edit Categories'** String get editCategories; /// No description provided for @editCategoriesDescription. /// /// In en, this message translates to: /// **'Add, edit, or delete categories'** String get editCategoriesDescription; /// No description provided for @color. /// /// In en, this message translates to: /// **'Color'** String get color; /// No description provided for @chooseIcon. /// /// In en, this message translates to: /// **'Pick icon'** String get chooseIcon; /// No description provided for @chooseIconHint. /// /// In en, this message translates to: /// **'Search'** String get chooseIconHint; /// No description provided for @categoryType. /// /// In en, this message translates to: /// **'Category type'** String get categoryType; /// No description provided for @addCategory. /// /// In en, this message translates to: /// **'Add category'** String get addCategory; /// No description provided for @editTags. /// /// In en, this message translates to: /// **'Edit Tags'** String get editTags; /// No description provided for @editTagsDescription. /// /// In en, this message translates to: /// **'Add, edit, or delete tags'** String get editTagsDescription; /// No description provided for @addTag. /// /// In en, this message translates to: /// **'Add tag'** String get addTag; /// No description provided for @editTag. /// /// In en, this message translates to: /// **'Edit tag'** String get editTag; /// No description provided for @loadSmsMessages. /// /// In en, this message translates to: /// **'Load SMS Messages'** String get loadSmsMessages; /// No description provided for @loadSmsMessagesDescription. /// /// In en, this message translates to: /// **'Load and process SMS messages to automatically create transactions'** String get loadSmsMessagesDescription; /// No description provided for @smsSettings. /// /// In en, this message translates to: /// **'Processing settings'** String get smsSettings; /// No description provided for @createTransaction. /// /// In en, this message translates to: /// **'Create transaction'** String get createTransaction; /// No description provided for @unknownSender. /// /// In en, this message translates to: /// **'Unknown sender'** String get unknownSender; /// No description provided for @smsProcessed. /// /// In en, this message translates to: /// **'Processed'** String get smsProcessed; /// No description provided for @smsNotProcessed. /// /// In en, this message translates to: /// **'Not processed'** String get smsNotProcessed; } class _AppLocalizationsDelegate extends LocalizationsDelegate { const _AppLocalizationsDelegate(); @override Future load(Locale locale) { return SynchronousFuture(lookupAppLocalizations(locale)); } @override bool isSupported(Locale locale) => ['en', 'ru'].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 'ru': return AppLocalizationsRu(); } 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.', ); }