495 lines
13 KiB
Dart
495 lines
13 KiB
Dart
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_tr.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('en'),
|
||
Locale('tr'),
|
||
];
|
||
|
||
/// No description provided for @settingsTitle.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Settings'**
|
||
String get settingsTitle;
|
||
|
||
/// No description provided for @tabGeneral.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'General'**
|
||
String get tabGeneral;
|
||
|
||
/// No description provided for @language.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Language'**
|
||
String get language;
|
||
|
||
/// No description provided for @sortBy.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Sort by'**
|
||
String get sortBy;
|
||
|
||
/// No description provided for @hoverColor.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Hover color'**
|
||
String get hoverColor;
|
||
|
||
/// No description provided for @sortByTime.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Time'**
|
||
String get sortByTime;
|
||
|
||
/// No description provided for @sortByName.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Name'**
|
||
String get sortByName;
|
||
|
||
/// No description provided for @sizeSection.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Size'**
|
||
String get sizeSection;
|
||
|
||
/// No description provided for @appDescription.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Simple, clean, light, fast image viewer.'**
|
||
String get appDescription;
|
||
|
||
/// No description provided for @shortcuts.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Shortcuts'**
|
||
String get shortcuts;
|
||
|
||
/// No description provided for @scNavKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Left/Right arrow'**
|
||
String get scNavKey;
|
||
|
||
/// No description provided for @scNavAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'previous/next image'**
|
||
String get scNavAction;
|
||
|
||
/// No description provided for @scOpenKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Ctrl+O'**
|
||
String get scOpenKey;
|
||
|
||
/// No description provided for @scOpenAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'open file'**
|
||
String get scOpenAction;
|
||
|
||
/// No description provided for @scSaveKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Ctrl+S'**
|
||
String get scSaveKey;
|
||
|
||
/// No description provided for @scSaveAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'save visible area (JPEG 95)'**
|
||
String get scSaveAction;
|
||
|
||
/// No description provided for @scFlipKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Ctrl+R'**
|
||
String get scFlipKey;
|
||
|
||
/// No description provided for @scFlipAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'flip horizontally (clears effects, press again to undo)'**
|
||
String get scFlipAction;
|
||
|
||
/// No description provided for @scCloseKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Ctrl+Q'**
|
||
String get scCloseKey;
|
||
|
||
/// No description provided for @scCloseAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'close window'**
|
||
String get scCloseAction;
|
||
|
||
/// No description provided for @scCloseAllKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Ctrl+Shift+Q'**
|
||
String get scCloseAllKey;
|
||
|
||
/// No description provided for @scCloseAllAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'close all windows'**
|
||
String get scCloseAllAction;
|
||
|
||
/// No description provided for @scFullscreenKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'F11'**
|
||
String get scFullscreenKey;
|
||
|
||
/// No description provided for @scFullscreenAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'toggle fullscreen'**
|
||
String get scFullscreenAction;
|
||
|
||
/// No description provided for @scExitFullscreenKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Esc'**
|
||
String get scExitFullscreenKey;
|
||
|
||
/// No description provided for @scExitFullscreenAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'exit fullscreen'**
|
||
String get scExitFullscreenAction;
|
||
|
||
/// No description provided for @scZoomKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Scroll'**
|
||
String get scZoomKey;
|
||
|
||
/// No description provided for @scZoomAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'zoom (10% per step)'**
|
||
String get scZoomAction;
|
||
|
||
/// No description provided for @scFineZoomKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Ctrl+scroll'**
|
||
String get scFineZoomKey;
|
||
|
||
/// No description provided for @scFineZoomAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'fine zoom (1% per step)'**
|
||
String get scFineZoomAction;
|
||
|
||
/// No description provided for @scPanKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Left-drag'**
|
||
String get scPanKey;
|
||
|
||
/// No description provided for @scPanAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'pan'**
|
||
String get scPanAction;
|
||
|
||
/// No description provided for @scFillKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Double click'**
|
||
String get scFillKey;
|
||
|
||
/// No description provided for @scFillAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'toggle fill/fit'**
|
||
String get scFillAction;
|
||
|
||
/// No description provided for @scResetKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Right double click'**
|
||
String get scResetKey;
|
||
|
||
/// No description provided for @scResetAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'reset effects'**
|
||
String get scResetAction;
|
||
|
||
/// No description provided for @scContrastKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Right-drag'**
|
||
String get scContrastKey;
|
||
|
||
/// No description provided for @scContrastAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'contrast'**
|
||
String get scContrastAction;
|
||
|
||
/// No description provided for @scRotateKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Shift+right-drag'**
|
||
String get scRotateKey;
|
||
|
||
/// No description provided for @scRotateAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'rotate'**
|
||
String get scRotateAction;
|
||
|
||
/// No description provided for @scSaturationKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Ctrl+right-drag'**
|
||
String get scSaturationKey;
|
||
|
||
/// No description provided for @scSaturationAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'saturation'**
|
||
String get scSaturationAction;
|
||
|
||
/// No description provided for @scBrightnessKey.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Ctrl+Shift+right-drag'**
|
||
String get scBrightnessKey;
|
||
|
||
/// No description provided for @scBrightnessAction.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'brightness'**
|
||
String get scBrightnessAction;
|
||
|
||
/// No description provided for @print.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Print'**
|
||
String get print;
|
||
|
||
/// No description provided for @fileProperties.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'File properties'**
|
||
String get fileProperties;
|
||
|
||
/// No description provided for @propResolution.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Resolution'**
|
||
String get propResolution;
|
||
|
||
/// No description provided for @propFileSize.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'File size'**
|
||
String get propFileSize;
|
||
|
||
/// No description provided for @propFormat.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Format'**
|
||
String get propFormat;
|
||
|
||
/// No description provided for @propModified.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Modified'**
|
||
String get propModified;
|
||
|
||
/// No description provided for @propPath.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Path'**
|
||
String get propPath;
|
||
|
||
/// No description provided for @close.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Close'**
|
||
String get close;
|
||
|
||
/// No description provided for @saveCrop.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Save visible area (JPEG 95)'**
|
||
String get saveCrop;
|
||
|
||
/// No description provided for @cropSaved.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Saved: {path}'**
|
||
String cropSaved(String path);
|
||
|
||
/// No description provided for @cropFileExists.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'A file with the same name already exists — nothing was written'**
|
||
String get cropFileExists;
|
||
|
||
/// No description provided for @cropUnsupported.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'This image format cannot be saved as a crop'**
|
||
String get cropUnsupported;
|
||
|
||
/// No description provided for @cropFailed.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Failed to save crop'**
|
||
String get cropFailed;
|
||
|
||
/// No description provided for @dragDropHint.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Drag images here\nor press Ctrl+O to open'**
|
||
String get dragDropHint;
|
||
|
||
/// No description provided for @dropHere.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Drop'**
|
||
String get dropHere;
|
||
|
||
/// No description provided for @imageLoadError.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Failed to load image'**
|
||
String get imageLoadError;
|
||
}
|
||
|
||
class _AppLocalizationsDelegate
|
||
extends LocalizationsDelegate<AppLocalizations> {
|
||
const _AppLocalizationsDelegate();
|
||
|
||
@override
|
||
Future<AppLocalizations> load(Locale locale) {
|
||
return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
|
||
}
|
||
|
||
@override
|
||
bool isSupported(Locale locale) =>
|
||
<String>['en', 'tr'].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 'tr':
|
||
return AppLocalizationsTr();
|
||
}
|
||
|
||
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.',
|
||
);
|
||
}
|