Skip to content

Commit 773b8df

Browse files
committed
Localize chart titles
1 parent 1bbb73c commit 773b8df

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

lib/l10n/app_en.arb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,31 @@
296296
"@weight": {
297297
"description": "The weight of a workout log or body weight entry"
298298
},
299+
"chartAllTimeTitle": "{name} all-time",
300+
"@chartAllTimeTitle": {
301+
"description": "All-time chart of 'name' (e.g. 'weight', 'body fat' etc.)",
302+
"type": "text",
303+
"placeholders": {
304+
"name": {}
305+
}
306+
},
307+
"chart30DaysTitle": "{name} last 30 days",
308+
"@chart30DaysTitle": {
309+
"description": "last 30 days chart of 'name' (e.g. 'weight', 'body fat' etc.)",
310+
"type": "text",
311+
"placeholders": {
312+
"name": {}
313+
}
314+
},
315+
"chartDuringPlanTitle": "{chartName} during nutritional plan {planName}",
316+
"@chartDuringPlanTitle": {
317+
"description": "chart of 'chartName' (e.g. 'weight', 'body fat' etc.) logged during plan",
318+
"type": "text",
319+
"placeholders": {
320+
"chartName": {},
321+
"planName": {}
322+
}
323+
},
299324
"measurement": "Measurement",
300325
"@measurement": {},
301326
"measurements": "Measurements",

lib/widgets/measurements/helpers.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
23
import 'package:wger/models/nutrition/nutritional_plan.dart';
34
import 'package:wger/widgets/measurements/charts.dart';
45

@@ -36,15 +37,15 @@ List<Widget> getOverviewWidgetsSeries(
3637
final monthAgo = DateTime.now().subtract(const Duration(days: 30));
3738
return [
3839
...getOverviewWidgets(
39-
'$name all-time',
40+
AppLocalizations.of(context).chartAllTimeTitle(name),
4041
entriesAll,
4142
entries7dAvg,
4243
unit,
4344
context,
4445
),
4546
if (plan != null)
4647
...getOverviewWidgets(
47-
'$name during nutritional plan ${plan.description}',
48+
AppLocalizations.of(context).chartDuringPlanTitle(name, plan.description),
4849
entriesAll.where((e) => e.date.isAfter(plan.creationDate)).toList(),
4950
entries7dAvg.where((e) => e.date.isAfter(plan.creationDate)).toList(),
5051
unit,
@@ -60,7 +61,7 @@ List<Widget> getOverviewWidgetsSeries(
6061
.date
6162
.isBefore(entriesAll.last.date.subtract(const Duration(days: 30)))))
6263
...getOverviewWidgets(
63-
'$name last 30 days',
64+
AppLocalizations.of(context).chart30DaysTitle(name),
6465
entriesAll.where((e) => e.date.isAfter(monthAgo)).toList(),
6566
entries7dAvg.where((e) => e.date.isAfter(monthAgo)).toList(),
6667
unit,

lib/widgets/weight/weight_overview.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import 'package:wger/widgets/weight/forms.dart';
3131

3232
class WeightOverview extends StatelessWidget {
3333
const WeightOverview();
34+
3435
@override
3536
Widget build(BuildContext context) {
3637
final profile = context.read<UserProvider>().profile;
@@ -46,7 +47,7 @@ class WeightOverview extends StatelessWidget {
4647
return Column(
4748
children: [
4849
...getOverviewWidgetsSeries(
49-
'Weight',
50+
AppLocalizations.of(context).weight,
5051
entriesAll,
5152
entries7dAvg,
5253
plan,

0 commit comments

Comments
 (0)