mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Move translations to new i18n approach
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:wger/models/http_exception.dart';
|
||||
|
||||
void showErrorDialog(dynamic exception, BuildContext context) {
|
||||
|
||||
1
lib/l10n.README
Normal file
1
lib/l10n.README
Normal file
@@ -0,0 +1 @@
|
||||
flutter gen-l10n
|
||||
3
lib/l10n.yaml
Normal file
3
lib/l10n.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
arb-dir: lib/l10n
|
||||
template-arb-file: app_en.arb
|
||||
output-localization-file: app_localizations.dart
|
||||
135
lib/l10n/app_en.arb
Normal file
135
lib/l10n/app_en.arb
Normal file
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"@@last_modified": "2020-11-11T15:04:05.523531",
|
||||
"labelWorkoutPlans": "Workout plans",
|
||||
"@labelWorkoutPlans": {
|
||||
"description": "Title for screen workout plans"
|
||||
},
|
||||
"labelWorkoutPlan": "Workout plan",
|
||||
"@labelWorkoutPlan": {
|
||||
"description": "Title for screen workout plan"
|
||||
},
|
||||
"labelDashboard": "Dashboard",
|
||||
"@labelDashboard": {
|
||||
"description": "Title for screen dashboard"
|
||||
},
|
||||
"successfullyDeleted": "Successfully deleted",
|
||||
"@successfullyDeleted": {
|
||||
"description": "Message when an item was successfully deleted"
|
||||
},
|
||||
"exercise": "Exercise",
|
||||
"@exercise": {
|
||||
"description": "An exercise for a workout"
|
||||
},
|
||||
"newWorkout": "New Workout",
|
||||
"@newWorkout": {
|
||||
"description": "Header when adding a new workout"
|
||||
},
|
||||
"repetitions": "Repetitions",
|
||||
"@repetitions": {
|
||||
"description": "Repetitions for an exercise set"
|
||||
},
|
||||
"rir": "RiR",
|
||||
"@rir": {
|
||||
"description": "Shorthand for Repetitions In Reserve"
|
||||
},
|
||||
"comment": "Comment",
|
||||
"@comment": {
|
||||
"description": "Comment, additional information"
|
||||
},
|
||||
"impression": "Impression",
|
||||
"@impression": {
|
||||
"description": "General impression (e.g. for a workout session) such as good, bad, etc."
|
||||
},
|
||||
"notes": "Notes",
|
||||
"@notes": {
|
||||
"description": "Personal notes, e.g. for a workout session"
|
||||
},
|
||||
"workoutSession": "Workout session",
|
||||
"@workoutSession": {
|
||||
"description": "A (logged) workout session"
|
||||
},
|
||||
"newDay": "New day",
|
||||
"newSet": "New set",
|
||||
"@newSet": {
|
||||
"description": "Header when adding a new set to a workout day"
|
||||
},
|
||||
"description": "Description",
|
||||
"save": "Description",
|
||||
"cancel": "Cancel",
|
||||
"add": "Add",
|
||||
"addMeal": "Add meal",
|
||||
"mealLogged": "Meal was successfully logged to diary",
|
||||
"addIngredient": "Add ingredient",
|
||||
"nutritionalPlan": "Nutritional plan",
|
||||
"nutritionalDiary": "Nutritional diary",
|
||||
"nutritionalPlans": "Nutritional plans",
|
||||
"anErrorOccurred": "An Error Occurred!",
|
||||
"dismiss": "Dismiss",
|
||||
"weight": "Weight",
|
||||
"@weight": {
|
||||
"description": "The weight of a workout log or body weight entry"
|
||||
},
|
||||
"date": "Date",
|
||||
"@date": {
|
||||
"description": "The date of a workout log or body weight entry"
|
||||
},
|
||||
"time": "Time",
|
||||
"@time": {
|
||||
"description": "The time of a meal or workout"
|
||||
},
|
||||
"timeStart": "Start time",
|
||||
"@timeStart": {
|
||||
"description": "The starting time of a workout"
|
||||
},
|
||||
"timeEnd": "End time",
|
||||
"@timeEnd": {
|
||||
"description": "The end time of a workout"
|
||||
},
|
||||
"ingredient": "Ingredient",
|
||||
"energy": "Energy",
|
||||
"@energy": {
|
||||
"description": "Energy in a meal, ingredient etc. e.g. in kJ"
|
||||
},
|
||||
"kcal": "kcal",
|
||||
"@kcal": {
|
||||
"description": "Energy in a meal in kilocalories, kcal"
|
||||
},
|
||||
"kJ": "kJ",
|
||||
"@kJ": {
|
||||
"description": "Energy in a meal in kilo joules, kJ"
|
||||
},
|
||||
"g": "g",
|
||||
"@g": {
|
||||
"description": "Abbreviation for gram"
|
||||
},
|
||||
"protein": "Protein",
|
||||
"carbohydrates": "Carbohydrates",
|
||||
"sugars": "Sugars",
|
||||
"fat": "Fat",
|
||||
"saturatedFat": "Saturated fat",
|
||||
"fibres": "Fibres",
|
||||
"sodium": "Sodium",
|
||||
"amount": "Amount",
|
||||
"@amount": {
|
||||
"description": "The amount (e.g. in grams) of an ingredient in a meal"
|
||||
},
|
||||
"newEntry": "New entry",
|
||||
"@newEntry": {
|
||||
"description": "Title when adding a new entry such as a weight or log entry"
|
||||
},
|
||||
"edit": "Edit",
|
||||
"loadingText": "Loading...",
|
||||
"@loadingText": {
|
||||
"description": "Text to show when entries are being loaded in the background: Loading..."
|
||||
},
|
||||
"delete": "Delete",
|
||||
"newNutritionalPlan": "New nutritional plan",
|
||||
"toggleDetails": "Toggle details",
|
||||
"@toggleDetails": {
|
||||
"description": "Switch to toggle detail / overview"
|
||||
},
|
||||
"aboutText": "wger Workout Manager is free, open source (FLOSS) software released under the GNU General Public version 3 or later. The code is freely available on github:",
|
||||
"@aboutText": {
|
||||
"description": "Text in the about dialog"
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"@@last_modified": "2020-11-11T15:04:05.523531",
|
||||
"labelWorkoutPlans": "Workout plans",
|
||||
"@labelWorkoutPlans": {
|
||||
"description": "Title for screen workout plans",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"labelWorkoutPlan": "Workout plan",
|
||||
"@labelWorkoutPlan": {
|
||||
"description": "Title for screen workout plan",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
{
|
||||
"@@last_modified": "2020-12-05T11:28:38.887425",
|
||||
"labelWorkoutPlans": "Workout plans",
|
||||
"@labelWorkoutPlans": {
|
||||
"description": "Title for screen workout plans",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newWorkout": "New Workout",
|
||||
"@newWorkout": {
|
||||
"description": "Header when adding a new workout",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newDay": "New day",
|
||||
"@newDay": {
|
||||
"description": "Header when adding a new day to a workout",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newSet": "New set",
|
||||
"@newSet": {
|
||||
"description": "Header when adding a new set to a workout day",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"description": "Description",
|
||||
"@description": {
|
||||
"description": "Description of a workout, nutritional plan, etc.",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"save": "Save",
|
||||
"@save": {
|
||||
"description": "Saving a new entry in the DB",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"cancel": "Cancel",
|
||||
"@cancel": {
|
||||
"description": "Cancelling an action",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"add": "Add",
|
||||
"@add": {
|
||||
"description": "Label for a button etc.",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"labelWorkoutPlan": "Workout plan",
|
||||
"@labelWorkoutPlan": {
|
||||
"description": "Title for screen workout plan",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"labelDashboard": "Dashboard",
|
||||
"@labelDashboard": {
|
||||
"description": "Title for screen dashboard",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"anErrorOccurred": "An Error Occurred!",
|
||||
"@anErrorOccurred": {
|
||||
"description": "Title for error popups",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"dismiss": "Dismiss",
|
||||
"@dismiss": {
|
||||
"description": "Button to close a dialog",
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that looks up messages for specific locales by
|
||||
// delegating to the appropriate library.
|
||||
|
||||
// Ignore issues from commonly used lints in this file.
|
||||
// ignore_for_file:implementation_imports, file_names, unnecessary_new
|
||||
// ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering
|
||||
// ignore_for_file:argument_type_not_assignable, invalid_assignment
|
||||
// ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases
|
||||
// ignore_for_file:comment_references
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
import 'package:intl/src/intl_helpers.dart';
|
||||
|
||||
import 'messages_en.dart' as messages_en;
|
||||
import 'messages_de.dart' as messages_de;
|
||||
import 'messages_messages.dart' as messages_messages;
|
||||
|
||||
typedef Future<dynamic> LibraryLoader();
|
||||
Map<String, LibraryLoader> _deferredLibraries = {
|
||||
'en': () => new Future.value(null),
|
||||
'de': () => new Future.value(null),
|
||||
'messages': () => new Future.value(null),
|
||||
};
|
||||
|
||||
MessageLookupByLibrary _findExact(String localeName) {
|
||||
switch (localeName) {
|
||||
case 'en':
|
||||
return messages_en.messages;
|
||||
case 'de':
|
||||
return messages_de.messages;
|
||||
case 'messages':
|
||||
return messages_messages.messages;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// User programs should call this before using [localeName] for messages.
|
||||
Future<bool> initializeMessages(String localeName) async {
|
||||
var availableLocale = Intl.verifiedLocale(
|
||||
localeName,
|
||||
(locale) => _deferredLibraries[locale] != null,
|
||||
onFailure: (_) => null);
|
||||
if (availableLocale == null) {
|
||||
return new Future.value(false);
|
||||
}
|
||||
var lib = _deferredLibraries[availableLocale];
|
||||
await (lib == null ? new Future.value(false) : lib());
|
||||
initializeInternalMessageLookup(() => new CompositeMessageLookup());
|
||||
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
|
||||
return new Future.value(true);
|
||||
}
|
||||
|
||||
bool _messagesExistFor(String locale) {
|
||||
try {
|
||||
return _findExact(locale) != null;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
|
||||
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
|
||||
onFailure: (_) => null);
|
||||
if (actualLocale == null) return null;
|
||||
return _findExact(actualLocale);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that provides messages for a de locale. All the
|
||||
// messages from the main program should be duplicated here with the same
|
||||
// function name.
|
||||
|
||||
// Ignore issues from commonly used lints in this file.
|
||||
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
|
||||
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
|
||||
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
|
||||
// ignore_for_file:unused_import, file_names
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'de';
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static _notInlinedMessages(_) => <String, Function> {
|
||||
"labelWorkoutPlan" : MessageLookupByLibrary.simpleMessage("Trainingsplan"),
|
||||
"labelWorkoutPlans" : MessageLookupByLibrary.simpleMessage("Trainingspläne")
|
||||
};
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that provides messages for a en locale. All the
|
||||
// messages from the main program should be duplicated here with the same
|
||||
// function name.
|
||||
|
||||
// Ignore issues from commonly used lints in this file.
|
||||
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
|
||||
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
|
||||
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
|
||||
// ignore_for_file:unused_import, file_names
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'en';
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static _notInlinedMessages(_) => <String, Function> {
|
||||
"labelWorkoutPlan" : MessageLookupByLibrary.simpleMessage("Workout plan"),
|
||||
"labelWorkoutPlans" : MessageLookupByLibrary.simpleMessage("Workout plans")
|
||||
};
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that provides messages for a messages locale. All the
|
||||
// messages from the main program should be duplicated here with the same
|
||||
// function name.
|
||||
|
||||
// Ignore issues from commonly used lints in this file.
|
||||
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
|
||||
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
|
||||
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
|
||||
// ignore_for_file:unused_import, file_names
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'messages';
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static _notInlinedMessages(_) => <String, Function> {
|
||||
"description" : MessageLookupByLibrary.simpleMessage("description"),
|
||||
"labelDashboard" : MessageLookupByLibrary.simpleMessage("Dashboard"),
|
||||
"labelWorkoutPlan" : MessageLookupByLibrary.simpleMessage("Workout plan"),
|
||||
"labelWorkoutPlans" : MessageLookupByLibrary.simpleMessage("Workout plans"),
|
||||
"newWorkout" : MessageLookupByLibrary.simpleMessage("new Workout")
|
||||
};
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
1. Add strings to locales.dart
|
||||
|
||||
2. Extract strings to arb files
|
||||
flutter pub pub run intl_translation:extract_to_arb --output-dir=lib\l10n lib\locale\locales.dart
|
||||
|
||||
3. Generate dart files (in linux you can do lib/l10n/intl_*.arb)
|
||||
flutter pub pub run intl_translation:generate_from_arb --output-dir=lib\l10n --no-use-deferred-loading lib/l10n/intl_en.arb lib/l10n/intl_de.arb lib/l10n/intl_messages.arb lib/locale/locales.dart
|
||||
@@ -1,466 +0,0 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:wger/l10n/messages_all.dart';
|
||||
|
||||
class AppLocalizations {
|
||||
static Future<AppLocalizations> load(Locale locale) {
|
||||
final String name = locale.countryCode.isEmpty ? locale.languageCode : locale.toString();
|
||||
final localeName = Intl.canonicalizedLocale(name);
|
||||
|
||||
return initializeMessages(localeName).then((bool _) {
|
||||
Intl.defaultLocale = localeName;
|
||||
return AppLocalizations();
|
||||
});
|
||||
}
|
||||
|
||||
static AppLocalizations of(BuildContext context) {
|
||||
return Localizations.of<AppLocalizations>(context, AppLocalizations);
|
||||
}
|
||||
|
||||
String get successfullyDeleted {
|
||||
return Intl.message(
|
||||
'Successfully deleted',
|
||||
name: 'successfullyDeleted',
|
||||
desc: 'Message when an item was successfully deleted',
|
||||
);
|
||||
}
|
||||
|
||||
String get labelWorkoutPlans {
|
||||
return Intl.message(
|
||||
'Workout plans',
|
||||
name: 'labelWorkoutPlans',
|
||||
desc: 'Title for screen workout plans',
|
||||
);
|
||||
}
|
||||
|
||||
String get exercise {
|
||||
return Intl.message(
|
||||
'Exercise',
|
||||
name: 'exercise',
|
||||
desc: 'An exercise for a workout',
|
||||
);
|
||||
}
|
||||
|
||||
String get newWorkout {
|
||||
return Intl.message(
|
||||
'New Workout',
|
||||
name: 'newWorkout',
|
||||
desc: 'Header when adding a new workout',
|
||||
);
|
||||
}
|
||||
|
||||
String get repetitions {
|
||||
return Intl.message(
|
||||
'Repetitions',
|
||||
name: 'repetitions',
|
||||
desc: 'Repetitions for an exercise set',
|
||||
);
|
||||
}
|
||||
|
||||
String get rir {
|
||||
return Intl.message(
|
||||
'rir',
|
||||
name: 'RiR',
|
||||
desc: 'Shorthand for Repetitions In Reserve',
|
||||
);
|
||||
}
|
||||
|
||||
String get comment {
|
||||
return Intl.message(
|
||||
'Comment',
|
||||
name: 'comment',
|
||||
desc: 'Comment, additional information',
|
||||
);
|
||||
}
|
||||
|
||||
String get impression {
|
||||
return Intl.message(
|
||||
'Impression',
|
||||
name: 'impression',
|
||||
desc: 'General Impression for a workout session (good, bad, etc.)',
|
||||
);
|
||||
}
|
||||
|
||||
String get notes {
|
||||
return Intl.message(
|
||||
'Notes',
|
||||
name: 'notes',
|
||||
desc: 'Personal notes for a workout session',
|
||||
);
|
||||
}
|
||||
|
||||
String get workoutSession {
|
||||
return Intl.message(
|
||||
'Workout session',
|
||||
name: 'workoutSession',
|
||||
desc: 'A logged workout session',
|
||||
);
|
||||
}
|
||||
|
||||
String get newDay {
|
||||
return Intl.message(
|
||||
'New day',
|
||||
name: 'newDay',
|
||||
desc: 'Header when adding a new day to a workout',
|
||||
);
|
||||
}
|
||||
|
||||
String get newSet {
|
||||
return Intl.message(
|
||||
'New set',
|
||||
name: 'newSet',
|
||||
desc: 'Header when adding a new set to a workout day',
|
||||
);
|
||||
}
|
||||
|
||||
String get description {
|
||||
return Intl.message(
|
||||
'Description',
|
||||
name: 'description',
|
||||
desc: 'Description of a workout, nutritional plan, etc.',
|
||||
);
|
||||
}
|
||||
|
||||
String get save {
|
||||
return Intl.message(
|
||||
'Save',
|
||||
name: 'save',
|
||||
desc: 'Saving a new entry in the DB',
|
||||
);
|
||||
}
|
||||
|
||||
String get cancel {
|
||||
return Intl.message(
|
||||
'Cancel',
|
||||
name: 'cancel',
|
||||
desc: 'Cancelling an action',
|
||||
);
|
||||
}
|
||||
|
||||
String get add {
|
||||
return Intl.message(
|
||||
'Add',
|
||||
name: 'add',
|
||||
desc: 'Label for a button etc.',
|
||||
);
|
||||
}
|
||||
|
||||
String get addMeal {
|
||||
return Intl.message(
|
||||
'Add meal',
|
||||
name: 'addMeal',
|
||||
desc: 'Header for form or label for button',
|
||||
);
|
||||
}
|
||||
|
||||
String get mealLogged {
|
||||
return Intl.message(
|
||||
'Meal was successfully logged to diary',
|
||||
name: 'mealLogged',
|
||||
desc: 'Info message after logging a meal',
|
||||
);
|
||||
}
|
||||
|
||||
String get addIngredient {
|
||||
return Intl.message(
|
||||
'Add ingredient',
|
||||
name: 'addIngredient',
|
||||
desc: 'Label for button to add a new ingredient to a meal',
|
||||
);
|
||||
}
|
||||
|
||||
String get labelWorkoutPlan {
|
||||
return Intl.message(
|
||||
'Workout plan',
|
||||
name: 'labelWorkoutPlan',
|
||||
desc: 'Title for screen workout plan',
|
||||
);
|
||||
}
|
||||
|
||||
String get nutritionalPlan {
|
||||
return Intl.message(
|
||||
'Nutritional plan',
|
||||
name: 'nutritionalPlan',
|
||||
desc: 'Title for screen nutritional plan',
|
||||
);
|
||||
}
|
||||
|
||||
String get nutritionalDiary {
|
||||
return Intl.message(
|
||||
'Nutritional diary',
|
||||
name: 'nutritionalDiary',
|
||||
desc: 'The nutritional diary for a plan',
|
||||
);
|
||||
}
|
||||
|
||||
String get nutritionalPlans {
|
||||
return Intl.message(
|
||||
'Nutritional plans',
|
||||
name: 'nutritionalPlans',
|
||||
desc: 'Title for screen nutritional plans overview',
|
||||
);
|
||||
}
|
||||
|
||||
String get labelDashboard {
|
||||
return Intl.message(
|
||||
'Dashboard',
|
||||
name: 'labelDashboard',
|
||||
desc: 'Title for screen dashboard',
|
||||
);
|
||||
}
|
||||
|
||||
String get anErrorOccurred {
|
||||
return Intl.message(
|
||||
'An Error Occurred!',
|
||||
name: 'anErrorOccurred',
|
||||
desc: 'Title for error popups',
|
||||
);
|
||||
}
|
||||
|
||||
String get dismiss {
|
||||
return Intl.message(
|
||||
'Dismiss',
|
||||
name: 'dismiss',
|
||||
desc: 'Button to close a dialog',
|
||||
);
|
||||
}
|
||||
|
||||
String get weight {
|
||||
return Intl.message(
|
||||
'Weight',
|
||||
name: 'weight',
|
||||
desc: 'The weight of a workout log or body weight entry',
|
||||
);
|
||||
}
|
||||
|
||||
String get date {
|
||||
return Intl.message(
|
||||
'Date',
|
||||
name: 'date',
|
||||
desc: 'The date of a workout log or body weight entry',
|
||||
);
|
||||
}
|
||||
|
||||
String get time {
|
||||
return Intl.message(
|
||||
'Time',
|
||||
name: 'time',
|
||||
desc: 'The time of a meal or workout',
|
||||
);
|
||||
}
|
||||
|
||||
String get timeStart {
|
||||
return Intl.message(
|
||||
'Start time',
|
||||
name: 'timeStart',
|
||||
desc: 'The starting time of a workout',
|
||||
);
|
||||
}
|
||||
|
||||
String get timeEnd {
|
||||
return Intl.message(
|
||||
'End time',
|
||||
name: 'timeEnd',
|
||||
desc: 'The end time of a workout',
|
||||
);
|
||||
}
|
||||
|
||||
String get ingredient {
|
||||
return Intl.message(
|
||||
'Ingredient',
|
||||
name: 'ingredient',
|
||||
desc: 'An ingredient',
|
||||
);
|
||||
}
|
||||
|
||||
String get energy {
|
||||
return Intl.message(
|
||||
'Energy',
|
||||
name: 'energy',
|
||||
desc: 'Energy in a meal, e.g. in kJ',
|
||||
);
|
||||
}
|
||||
|
||||
String get kcal {
|
||||
return Intl.message(
|
||||
'kcal',
|
||||
name: 'kcal',
|
||||
desc: 'Energy in a meal in kilocalories, kcal',
|
||||
);
|
||||
}
|
||||
|
||||
String get kj {
|
||||
return Intl.message(
|
||||
'kJ',
|
||||
name: 'kj',
|
||||
desc: 'Energy in a meal in kilo joules, kJ',
|
||||
);
|
||||
}
|
||||
|
||||
String get g {
|
||||
return Intl.message(
|
||||
'g',
|
||||
name: 'g',
|
||||
desc: 'Abbreviation for gram',
|
||||
);
|
||||
}
|
||||
|
||||
String get protein {
|
||||
return Intl.message(
|
||||
'Protein',
|
||||
name: 'protein',
|
||||
desc: 'Protein content',
|
||||
);
|
||||
}
|
||||
|
||||
String get carbohydrates {
|
||||
return Intl.message(
|
||||
'Carbohydrates',
|
||||
name: 'carbohydrates',
|
||||
desc: 'Carbohydrates content',
|
||||
);
|
||||
}
|
||||
|
||||
String get sugars {
|
||||
return Intl.message(
|
||||
'Sugars',
|
||||
name: 'sugars',
|
||||
desc: 'sugar content (out of the carbohydrates)',
|
||||
);
|
||||
}
|
||||
|
||||
String get fat {
|
||||
return Intl.message(
|
||||
'Fat',
|
||||
name: 'fat',
|
||||
desc: 'Fat content',
|
||||
);
|
||||
}
|
||||
|
||||
String get saturatedFat {
|
||||
return Intl.message(
|
||||
'Saturated fat',
|
||||
name: 'saturatedFat',
|
||||
desc: 'Saturated fat content (out of the fat)',
|
||||
);
|
||||
}
|
||||
|
||||
String get fibres {
|
||||
return Intl.message(
|
||||
'Fibres',
|
||||
name: 'fibres',
|
||||
desc: 'Fibres content',
|
||||
);
|
||||
}
|
||||
|
||||
String get sodium {
|
||||
return Intl.message(
|
||||
'Sodium',
|
||||
name: 'sodium',
|
||||
desc: 'Sodium content',
|
||||
);
|
||||
}
|
||||
|
||||
String get amount {
|
||||
return Intl.message(
|
||||
'Amount',
|
||||
name: 'amount',
|
||||
desc: 'The amount (e.g. in grams) of an ingredient in a meal',
|
||||
);
|
||||
}
|
||||
|
||||
String get newEntry {
|
||||
return Intl.message(
|
||||
'New entry',
|
||||
name: 'newEntry',
|
||||
desc: 'Header when adding a new entry such as a weight or log entry',
|
||||
);
|
||||
}
|
||||
|
||||
String get edit {
|
||||
return Intl.message(
|
||||
'Edit',
|
||||
name: 'edit',
|
||||
desc: 'Header when adding an existing entry',
|
||||
);
|
||||
}
|
||||
|
||||
String get loadingText {
|
||||
return Intl.message(
|
||||
'Loading...',
|
||||
name: 'loadingText',
|
||||
desc: 'Text to show when entries are being loaded in the background',
|
||||
);
|
||||
}
|
||||
|
||||
String get delete {
|
||||
return Intl.message(
|
||||
'Delete',
|
||||
name: 'delete',
|
||||
desc: 'Header when deleting an existing entry',
|
||||
);
|
||||
}
|
||||
|
||||
String get newNutritionalPlan {
|
||||
return Intl.message(
|
||||
'New nutritional plan',
|
||||
name: 'newNutritionalPlan',
|
||||
desc: 'Header when adding a new nutritional plan',
|
||||
);
|
||||
}
|
||||
|
||||
String get toggleDetails {
|
||||
return Intl.message(
|
||||
'Toggle details',
|
||||
name: 'toggleDetails',
|
||||
desc: 'Switch to toggle detail / overview',
|
||||
);
|
||||
}
|
||||
|
||||
String get aboutText {
|
||||
return Intl.message(
|
||||
'wger Workout Manager is free, open source (FLOSS) software released '
|
||||
'under the GNU General Public version 3 or later. '
|
||||
'The code is freely available on github: ',
|
||||
name: 'aboutText',
|
||||
desc: 'Text in the about dialog',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
|
||||
const AppLocalizationsDelegate();
|
||||
|
||||
@override
|
||||
bool isSupported(Locale locale) {
|
||||
return ['en', 'de'].contains(locale.languageCode);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<AppLocalizations> load(Locale locale) {
|
||||
return AppLocalizations.load(locale);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReload(AppLocalizationsDelegate old) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
import 'package:wger/providers/exercises.dart';
|
||||
import 'package:wger/providers/nutrition.dart';
|
||||
@@ -103,17 +102,8 @@ class MyApp extends StatelessWidget {
|
||||
NutritionScreen.routeName: (ctx) => NutritionScreen(),
|
||||
NutritionalPlanScreen.routeName: (ctx) => NutritionalPlanScreen(),
|
||||
},
|
||||
localizationsDelegates: [
|
||||
// ... app-specific localization delegate[s] here
|
||||
AppLocalizationsDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [
|
||||
const Locale('en', ''), // English
|
||||
const Locale('de', ''), // German
|
||||
],
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/providers/auth.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
import 'package:wger/providers/exercises.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||
import 'package:wger/providers/nutrition.dart';
|
||||
import 'package:wger/widgets/core/bottom_sheet.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||
import 'package:wger/providers/nutrition.dart';
|
||||
import 'package:wger/widgets/app_drawer.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/body_weight/weight_entry.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
import 'package:wger/widgets/app_drawer.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/workouts/workout_plan.dart';
|
||||
import 'package:wger/providers/workout_plans.dart';
|
||||
import 'package:wger/screens/workout_plans_screen.dart';
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/workouts/workout_plan.dart';
|
||||
import 'package:wger/providers/workout_plans.dart';
|
||||
import 'package:wger/widgets/app_drawer.dart';
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/providers/auth.dart';
|
||||
|
||||
class AppDrawer extends StatelessWidget {
|
||||
|
||||
@@ -19,10 +19,10 @@ import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/workouts/session.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
import 'package:wger/providers/nutrition.dart';
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||
import 'package:wger/models/workouts/workout_plan.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import 'package:charts_flutter/flutter.dart' as charts;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||
import 'package:wger/models/nutrition/nutritrional_values.dart';
|
||||
import 'package:wger/theme/theme.dart';
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/helpers/ui.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/http_exception.dart';
|
||||
import 'package:wger/models/nutrition/meal.dart';
|
||||
import 'package:wger/models/nutrition/meal_item.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/nutrition/meal.dart';
|
||||
import 'package:wger/models/nutrition/meal_item.dart';
|
||||
import 'package:wger/providers/nutrition.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||
import 'package:wger/models/nutrition/nutritrional_values.dart';
|
||||
import 'package:wger/widgets/core/bottom_sheet.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
import 'package:wger/widgets/core/bottom_sheet.dart';
|
||||
import 'package:wger/widgets/weight/charts.dart';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/helpers/ui.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/body_weight/weight_entry.dart';
|
||||
import 'package:wger/models/http_exception.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/set.dart';
|
||||
import 'package:wger/models/workouts/setting.dart';
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/helpers/ui.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/http_exception.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:wger/locale/locales.dart';
|
||||
import 'package:wger/models/workouts/workout_plan.dart';
|
||||
import 'package:wger/screens/workout_plan_screen.dart';
|
||||
import 'package:wger/widgets/core/bottom_sheet.dart';
|
||||
|
||||
@@ -102,3 +102,5 @@ flutter:
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
|
||||
generate: true
|
||||
Reference in New Issue
Block a user