578 lines
15 KiB
Dart
578 lines
15 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_de.dart';
|
||
import 'app_localizations_en.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('de'),
|
||
Locale('en'),
|
||
];
|
||
|
||
/// No description provided for @navTimer.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Timer'**
|
||
String get navTimer;
|
||
|
||
/// No description provided for @navEntries.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Entries'**
|
||
String get navEntries;
|
||
|
||
/// No description provided for @navProjects.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Projects'**
|
||
String get navProjects;
|
||
|
||
/// No description provided for @navReports.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Reports'**
|
||
String get navReports;
|
||
|
||
/// No description provided for @navSettings.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Settings'**
|
||
String get navSettings;
|
||
|
||
/// No description provided for @timerStart.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Start'**
|
||
String get timerStart;
|
||
|
||
/// No description provided for @timerStop.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Stop'**
|
||
String get timerStop;
|
||
|
||
/// No description provided for @timerDiscard.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Discard'**
|
||
String get timerDiscard;
|
||
|
||
/// No description provided for @timerDiscardConfirm.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Discard this entry?'**
|
||
String get timerDiscardConfirm;
|
||
|
||
/// No description provided for @timerDiscardBody.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'The current time entry will be deleted.'**
|
||
String get timerDiscardBody;
|
||
|
||
/// No description provided for @timerSelectProject.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Select project'**
|
||
String get timerSelectProject;
|
||
|
||
/// No description provided for @timerAddNote.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Add a note…'**
|
||
String get timerAddNote;
|
||
|
||
/// No description provided for @timerTodayTotal.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Today: {duration}'**
|
||
String timerTodayTotal(String duration);
|
||
|
||
/// No description provided for @timerRecentToday.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Recent today'**
|
||
String get timerRecentToday;
|
||
|
||
/// No description provided for @entriesTitle.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Entries'**
|
||
String get entriesTitle;
|
||
|
||
/// No description provided for @entriesEmpty.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'No entries yet.'**
|
||
String get entriesEmpty;
|
||
|
||
/// No description provided for @entriesAdd.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Add entry'**
|
||
String get entriesAdd;
|
||
|
||
/// No description provided for @entriesDeleted.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Entry deleted'**
|
||
String get entriesDeleted;
|
||
|
||
/// No description provided for @entriesUndo.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Undo'**
|
||
String get entriesUndo;
|
||
|
||
/// No description provided for @projectsTitle.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Projects'**
|
||
String get projectsTitle;
|
||
|
||
/// No description provided for @projectsEmpty.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'No projects yet.'**
|
||
String get projectsEmpty;
|
||
|
||
/// No description provided for @projectsArchivedEmpty.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'No archived projects.'**
|
||
String get projectsArchivedEmpty;
|
||
|
||
/// No description provided for @projectsAdd.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'New project'**
|
||
String get projectsAdd;
|
||
|
||
/// No description provided for @projectsActive.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Active'**
|
||
String get projectsActive;
|
||
|
||
/// No description provided for @projectsArchived.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Archived'**
|
||
String get projectsArchived;
|
||
|
||
/// No description provided for @projectsName.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Name'**
|
||
String get projectsName;
|
||
|
||
/// No description provided for @projectsDescription.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Description (optional)'**
|
||
String get projectsDescription;
|
||
|
||
/// No description provided for @projectsArchive.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Archive'**
|
||
String get projectsArchive;
|
||
|
||
/// No description provided for @projectsUnarchive.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Unarchive'**
|
||
String get projectsUnarchive;
|
||
|
||
/// No description provided for @projectsDeleteTitle.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Delete project?'**
|
||
String get projectsDeleteTitle;
|
||
|
||
/// No description provided for @projectsDeleteBlocked.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Cannot delete — project has time entries.'**
|
||
String get projectsDeleteBlocked;
|
||
|
||
/// No description provided for @projectsColorLabel.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Color'**
|
||
String get projectsColorLabel;
|
||
|
||
/// No description provided for @reportsTitle.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Reports'**
|
||
String get reportsTitle;
|
||
|
||
/// No description provided for @reportsDay.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Day'**
|
||
String get reportsDay;
|
||
|
||
/// No description provided for @reportsWeek.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Week'**
|
||
String get reportsWeek;
|
||
|
||
/// No description provided for @reportsMonth.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Month'**
|
||
String get reportsMonth;
|
||
|
||
/// No description provided for @reportsTotal.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Total'**
|
||
String get reportsTotal;
|
||
|
||
/// No description provided for @reportsNoData.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'No data for this period'**
|
||
String get reportsNoData;
|
||
|
||
/// No description provided for @reportsByProject.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'By project'**
|
||
String get reportsByProject;
|
||
|
||
/// No description provided for @timerQuickAccess.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Quick Access'**
|
||
String get timerQuickAccess;
|
||
|
||
/// No description provided for @timerSwitched.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'{stopped} stopped, {started} started'**
|
||
String timerSwitched(String stopped, String started);
|
||
|
||
/// No description provided for @timerStopped.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'{name} stopped'**
|
||
String timerStopped(String name);
|
||
|
||
/// No description provided for @settingsTitle.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Settings'**
|
||
String get settingsTitle;
|
||
|
||
/// No description provided for @settingsAppearance.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Appearance'**
|
||
String get settingsAppearance;
|
||
|
||
/// No description provided for @settingsTheme.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Theme'**
|
||
String get settingsTheme;
|
||
|
||
/// No description provided for @settingsThemeSystem.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'System'**
|
||
String get settingsThemeSystem;
|
||
|
||
/// No description provided for @settingsThemeLight.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Light'**
|
||
String get settingsThemeLight;
|
||
|
||
/// No description provided for @settingsThemeDark.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Dark'**
|
||
String get settingsThemeDark;
|
||
|
||
/// No description provided for @settingsLanguage.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Language'**
|
||
String get settingsLanguage;
|
||
|
||
/// No description provided for @settingsLanguageSystem.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'System'**
|
||
String get settingsLanguageSystem;
|
||
|
||
/// No description provided for @settingsTimer.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Timer'**
|
||
String get settingsTimer;
|
||
|
||
/// No description provided for @settingsQuickAccessCount.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Quick access projects'**
|
||
String get settingsQuickAccessCount;
|
||
|
||
/// No description provided for @settingsQuickAccessCountHint.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Number of frequently used projects shown in quick access ({min}–{max})'**
|
||
String settingsQuickAccessCountHint(int min, int max);
|
||
|
||
/// No description provided for @settingsData.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Data'**
|
||
String get settingsData;
|
||
|
||
/// No description provided for @settingsExport.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Export data'**
|
||
String get settingsExport;
|
||
|
||
/// No description provided for @settingsAbout.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'About'**
|
||
String get settingsAbout;
|
||
|
||
/// No description provided for @settingsVersion.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Version'**
|
||
String get settingsVersion;
|
||
|
||
/// No description provided for @settingsLicences.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Licences'**
|
||
String get settingsLicences;
|
||
|
||
/// No description provided for @exportTitle.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Export data'**
|
||
String get exportTitle;
|
||
|
||
/// No description provided for @exportFormat.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Format'**
|
||
String get exportFormat;
|
||
|
||
/// No description provided for @exportRange.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Date range'**
|
||
String get exportRange;
|
||
|
||
/// No description provided for @exportProject.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Project (optional)'**
|
||
String get exportProject;
|
||
|
||
/// No description provided for @exportAllProjects.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'All projects'**
|
||
String get exportAllProjects;
|
||
|
||
/// No description provided for @exportShare.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Share'**
|
||
String get exportShare;
|
||
|
||
/// No description provided for @exportFailed.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Export failed: {error}'**
|
||
String exportFailed(String error);
|
||
|
||
/// 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 @delete.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Delete'**
|
||
String get delete;
|
||
|
||
/// No description provided for @edit.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Edit'**
|
||
String get edit;
|
||
|
||
/// No description provided for @confirm.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Confirm'**
|
||
String get confirm;
|
||
|
||
/// No description provided for @today.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Today'**
|
||
String get today;
|
||
|
||
/// No description provided for @yesterday.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Yesterday'**
|
||
String get yesterday;
|
||
|
||
/// No description provided for @thisWeek.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'This week'**
|
||
String get thisWeek;
|
||
|
||
/// No description provided for @thisMonth.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'This month'**
|
||
String get thisMonth;
|
||
}
|
||
|
||
class _AppLocalizationsDelegate
|
||
extends LocalizationsDelegate<AppLocalizations> {
|
||
const _AppLocalizationsDelegate();
|
||
|
||
@override
|
||
Future<AppLocalizations> load(Locale locale) {
|
||
return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
|
||
}
|
||
|
||
@override
|
||
bool isSupported(Locale locale) =>
|
||
<String>['de', 'en'].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 'de':
|
||
return AppLocalizationsDe();
|
||
case 'en':
|
||
return AppLocalizationsEn();
|
||
}
|
||
|
||
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.',
|
||
);
|
||
}
|