diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 627507f7..663ef66b 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -58,6 +58,8 @@ "@gymMode": { "description": "Label when starting the gym mode" }, + "logHelpEntries": "If on a single day there is more than one entry with the same number of repetitions, but different weights, only the entry with the higher weight is shown in the diagram.", + "logHelpEntriesUnits": "Note that only entries with a weight unit (kg or lb) and repetitions are charted, other combinations such as time or until failure are ignored here.", "description": "Description", "@description": {}, "save": "Save", @@ -138,10 +140,18 @@ "@amount": { "description": "The amount (e.g. in grams) of an ingredient in a meal" }, + "unit": "Unit", + "@unit": { + "description": "The unit used for a repetition (kg, time, etc.)" + }, "newEntry": "New entry", "@newEntry": { "description": "Title when adding a new entry such as a weight or log entry" }, + "noWeightEntries": "You have no weight entries", + "@noWeightEntries": { + "description": "Message shown when the user has no logged weight entries" + }, "edit": "Edit", "@edit": {}, "loadingText": "Loading...", @@ -159,5 +169,22 @@ "aboutText": "wger is copylefted libre software, licensed GPLv3+ and available on GitHub:", "@aboutText": { "description": "Text in the about dialog" + }, + "calendar": "Calendar", + "goToToday": "Go to today", + "@goToToday": { + "description": "Label on button to jump back to 'today' in the calendar widget" + }, + "enterValue": "Please enter a value", + "@enterValue": { + "description": "Error message when the user hasn't entered a value on a required field" + }, + "enterValidNumber": "Please enter a valid number", + "@enterValidNumber": { + "description": "Error message when the user has submitted an invalid number (e.g. '3,.,.,.')" + }, + "selectIngredient": "Please select an ingredient", + "@selectIngredient": { + "description": "Error message when the user hasn't selected an ingredient from the autocompleter" } } diff --git a/lib/screens/dashboard.dart b/lib/screens/dashboard.dart index b60832b0..a69bcd93 100644 --- a/lib/screens/dashboard.dart +++ b/lib/screens/dashboard.dart @@ -101,7 +101,7 @@ class _DashboardScreenState extends State { DashboardWeightWidget(context: context), Container( height: 650, // TODO: refactor calendar so we can get rid of size - child: DashboardCalendarWidget(title: 'Calendar'), + child: DashboardCalendarWidget(), ), ], ), diff --git a/lib/widgets/dashboard/calendar.dart b/lib/widgets/dashboard/calendar.dart index 1a305455..9b47a3b2 100644 --- a/lib/widgets/dashboard/calendar.dart +++ b/lib/widgets/dashboard/calendar.dart @@ -30,6 +30,8 @@ import 'package:wger/providers/workout_plans.dart'; import 'package:wger/theme/theme.dart'; // Example holidays +// +// (perhaps we can do something with this, such as marking future training days?) final Map _holidays = { DateTime(2021, 1, 1): ['New Year\'s Day'], DateTime(2021, 1, 6): ['Epiphany'], @@ -62,9 +64,7 @@ class Event { } class DashboardCalendarWidget extends StatefulWidget { - DashboardCalendarWidget({Key key, this.title}) : super(key: key); - - final String title; + DashboardCalendarWidget({Key key}) : super(key: key); @override _DashboardCalendarWidgetState createState() => _DashboardCalendarWidgetState(); @@ -136,7 +136,7 @@ class _DashboardCalendarWidgetState extends State // Add events to lists _events[date].add(Event( EventType.session, - 'Impression: ${session.impressionAsString} $time', + '${AppLocalizations.of(context).impression}: ${session.impressionAsString} $time', )); } }); @@ -185,7 +185,11 @@ class _DashboardCalendarWidgetState extends State mainAxisSize: MainAxisSize.max, children: [ const SizedBox(height: 8.0), - Text(widget.title, style: Theme.of(context).textTheme.headline4), + Text( + AppLocalizations.of(context).calendar, + style: Theme.of(context).textTheme.headline4, + ), + // Switch out 2 lines below to play with TableCalendar's settings //----------------------- _buildTableCalendar(), @@ -193,7 +197,6 @@ class _DashboardCalendarWidgetState extends State const SizedBox(height: 8.0), _buildButtons(), const SizedBox(height: 8.0), - //_buildEventList(), Expanded(child: _buildEventList()), ], ), @@ -358,7 +361,7 @@ class _DashboardCalendarWidgetState extends State mainAxisAlignment: MainAxisAlignment.end, children: [ TextButton( - child: Text('Go to today'), + child: Text(AppLocalizations.of(context).goToToday), onPressed: () async { final today = DateTime.now(); _calendarController.setSelectedDay( diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index baeee5c4..8f81a12e 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -149,7 +149,7 @@ class _DashboardWeightWidgetState extends State { : Container( alignment: Alignment.center, height: 150, - child: Text('You have no weight entries'), + child: Text(AppLocalizations.of(context).noWeightEntries), ), Row( mainAxisAlignment: MainAxisAlignment.end, @@ -213,7 +213,7 @@ class _DashboardWorkoutWidgetState extends State { ...set.settings.map((s) { return Column( children: [ - Text(s.exerciseObj.name, style: TextStyle(fontWeight: FontWeight.bold)), + Text(s.exerciseObj.name), Text(s.repsText), SizedBox(height: 10), ], diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index fca1d0d5..b831f1ae 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -145,10 +145,10 @@ class MealItemForm extends StatelessWidget { }, validator: (value) { if (value.isEmpty) { - return 'Please select an ingredient'; + return AppLocalizations.of(context).selectIngredient; } if (mealItem.ingredientId == null) { - return 'Please select an ingredient'; + return AppLocalizations.of(context).selectIngredient; } return null; }, @@ -165,7 +165,7 @@ class MealItemForm extends StatelessWidget { try { double.parse(value); } catch (error) { - return 'Please enter a valid number'; + return AppLocalizations.of(context).enterValidNumber; } return null; }, diff --git a/lib/widgets/weight/forms.dart b/lib/widgets/weight/forms.dart index 80f1416f..aff44639 100644 --- a/lib/widgets/weight/forms.dart +++ b/lib/widgets/weight/forms.dart @@ -61,12 +61,12 @@ class WeightForm extends StatelessWidget { }, validator: (value) { if (value.isEmpty) { - return 'Please enter a weight'; + return AppLocalizations.of(context).enterValue; } try { double.parse(value); } catch (error) { - return 'Please enter a valid number'; + return AppLocalizations.of(context).enterValidNumber; } return null; }, diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 96cc3d94..a7270661 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -211,7 +211,7 @@ class LogPage extends StatelessWidget { try { double.parse(value); } catch (error) { - return 'Please enter a valid number'; + return AppLocalizations.of(context).enterValidNumber; } return null; }, diff --git a/lib/widgets/workouts/log.dart b/lib/widgets/workouts/log.dart index 6551ded0..3716f41a 100644 --- a/lib/widgets/workouts/log.dart +++ b/lib/widgets/workouts/log.dart @@ -18,6 +18,7 @@ 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/models/exercises/exercise.dart'; @@ -90,11 +91,11 @@ class ExerciseLog extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Text('Amount'), - Text('Unit'), - Text('Weight'), - Text('Unit'), - Text('RiR'), + Text(AppLocalizations.of(context).amount), + Text(AppLocalizations.of(context).unit), + Text(AppLocalizations.of(context).weight), + Text(AppLocalizations.of(context).unit), + Text(AppLocalizations.of(context).rir), ], ), ], diff --git a/lib/widgets/workouts/workout_logs.dart b/lib/widgets/workouts/workout_logs.dart index 626e50c2..4ab71031 100644 --- a/lib/widgets/workouts/workout_logs.dart +++ b/lib/widgets/workouts/workout_logs.dart @@ -17,6 +17,7 @@ */ import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/screens/workout_plan_screen.dart'; import 'package:wger/widgets/workouts/log.dart'; @@ -47,6 +48,7 @@ class _WorkoutLogsState extends State { style: Theme.of(context).textTheme.headline5, ), ), + /* Padding( padding: const EdgeInsets.all(8.0), child: Text( @@ -55,21 +57,18 @@ class _WorkoutLogsState extends State { textAlign: TextAlign.justify, ), ), + */ Padding( padding: const EdgeInsets.all(8.0), child: Text( - 'If on a single day there is more than one entry with the same' - 'number of repetitions, but different weights, only the entry with' - 'the higher weight is shown in the diagram.', + AppLocalizations.of(context).logHelpEntries, textAlign: TextAlign.justify, ), ), Padding( padding: const EdgeInsets.all(8.0), child: Text( - 'Note that only entries with a weight unit (kg or lb) and repetitions' - 'are charted, other combinations such as time or until failure' - 'are ignored here.', + AppLocalizations.of(context).logHelpEntriesUnits, textAlign: TextAlign.justify, ), ),