Skip to content

Commit 63ada99

Browse files
authored
Merge pull request #669 from FutureYL3/master
Fixing some hard-coded texts
2 parents c664cce + 27e28e7 commit 63ada99

File tree

6 files changed

+85
-13
lines changed

6 files changed

+85
-13
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- Dieter Plaetinck - <https://github.com/Dieterbe>
3131
- Dennis van Peer - <https://github.com/Denpeer>
3232
- sizzlesloth - <https://github.com/sizzlesloth>
33+
- Xianglin Zeng - <https://github.com/FutureYL3>
3334

3435
## Translators
3536

lib/l10n/app_en.arb

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,5 +888,29 @@
888888
"@log": {
889889
"description": "Log a specific meal (imperative form)"
890890
},
891-
"done": "Done"
891+
"done": "Done",
892+
"overallChangeWeight": "Overall change",
893+
"@overallChangeWeight": {
894+
"description": "Overall change in weight, added for localization"
895+
},
896+
"goalTypeMeals": "From meals",
897+
"@goalTypeMeals": {
898+
"description": "added for localization of Class GoalType's filed meals"
899+
},
900+
"goalTypeBasic": "Basic",
901+
"@goalTypeBasic": {
902+
"description": "added for localization of Class GoalType's filed basic"
903+
},
904+
"goalTypeAdvanced": "Advanced",
905+
"@goalTypeAdvanced": {
906+
"description": "added for localization of Class GoalType's filed advanced"
907+
},
908+
"indicatorRaw": "raw",
909+
"@indicatorRaw": {
910+
"description": "added for localization of Class Indicator's field text"
911+
},
912+
"indicatorAvg": "avg",
913+
"@indicatorAvg": {
914+
"description": "added for localization of Class Indicator's field text"
915+
}
892916
}

lib/l10n/app_zh.arb

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@
250250
},
251251
"delete": "删除",
252252
"@delete": {},
253-
"loadingText": "加载...",
253+
"loadingText": "加载中...",
254254
"@loadingText": {
255-
"description": "Text to show when entries are being loaded in the background: Loading..."
255+
"description": "Text to show when entries are being loaded in the background: Loading..., changed from \"加载\" to \"加载中\""
256256
},
257257
"edit": "编辑",
258258
"@edit": {},
@@ -324,9 +324,9 @@
324324
"@date": {
325325
"description": "The date of a workout log or body weight entry"
326326
},
327-
"weight": "重量",
327+
"weight": "体重",
328328
"@weight": {
329-
"description": "The weight of a workout log or body weight entry"
329+
"description": "The weight of a workout log or body weight entry, changed from \"重量\" to \"体重\""
330330
},
331331
"anErrorOccurred": "出错了!",
332332
"@anErrorOccurred": {},
@@ -348,9 +348,9 @@
348348
"@addMeal": {},
349349
"save": "保存",
350350
"@save": {},
351-
"name": "",
351+
"name": "名称",
352352
"@name": {
353-
"description": "Name for a workout or nutritional plan"
353+
"description": "Name for a workout or nutritional plan, changed from \"名\" to \"名称\""
354354
},
355355
"description": "描述",
356356
"@description": {},
@@ -670,5 +670,39 @@
670670
}
671671
},
672672
"noMeasurementEntries": "您没有测量条目",
673-
"@noMeasurementEntries": {}
674-
}
673+
"@noMeasurementEntries": {},
674+
"overallChangeWeight": "总体变化",
675+
"@overallChangeWeight": {
676+
"description": "Overall change in weight"
677+
},
678+
"goalTypeMeals": "从饮食出发",
679+
"goalTypeBasic": "基础",
680+
"goalTypeAdvanced": "进阶",
681+
"chartAllTimeTitle": "{name} 历史记录曲线",
682+
"@chartAllTimeTitle": {
683+
"description": "All-time chart of 'name' (e.g. 'weight', 'body fat' etc.)",
684+
"type": "text",
685+
"placeholders": {
686+
"name": {}
687+
}
688+
},
689+
"chartDuringPlanTitle": "{chartName} 在计划 \"{planName}\" 期间的改变曲线",
690+
"@chartDuringPlanTitle": {
691+
"description": "chart of 'chartName' (e.g. 'weight', 'body fat' etc.) logged during plan",
692+
"type": "text",
693+
"placeholders": {
694+
"chartName": {},
695+
"planName": {}
696+
}
697+
},
698+
"indicatorRaw": "原始值",
699+
"indicatorAvg": "平均值",
700+
"textPromptTitle": "准备就绪?",
701+
"@textPromptTitle": {
702+
"description": "Title for the text prompt"
703+
},
704+
"textPromptSubheading": "点击右下角按钮开始",
705+
"@textPromptSubheading": {
706+
"description": "Subheading for the text prompt"
707+
}
708+
}

lib/widgets/measurements/charts.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class MeasurementOverallChangeWidget extends StatelessWidget {
3737
? '-'
3838
: '';
3939

40-
return Text('overall change $prefix ${delta.abs().toStringAsFixed(1)} $_unit');
40+
// ignore: prefer_interpolation_to_compose_strings
41+
return Text(AppLocalizations.of(context).overallChangeWeight +
42+
'$prefix ${delta.abs().toStringAsFixed(1)} $_unit');
4143
}
4244
}
4345

lib/widgets/measurements/helpers.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ List<Widget> getOverviewWidgetsSeries(
7777
Row(
7878
mainAxisAlignment: MainAxisAlignment.center,
7979
children: [
80-
Indicator(color: Theme.of(context).colorScheme.primary, text: 'raw', isSquare: true),
81-
Indicator(color: Theme.of(context).colorScheme.tertiary, text: 'avg', isSquare: true),
80+
Indicator(color: Theme.of(context).colorScheme.primary, text: AppLocalizations.of(context).indicatorRaw, isSquare: true),
81+
Indicator(color: Theme.of(context).colorScheme.tertiary, text: AppLocalizations.of(context).indicatorAvg, isSquare: true),
8282
],
8383
),
8484
];

lib/widgets/nutrition/forms.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,17 @@ enum GoalType {
484484

485485
const GoalType(this.label);
486486
final String label;
487+
488+
String getI18nLabel(BuildContext context) {
489+
switch (this) {
490+
case GoalType.meals:
491+
return AppLocalizations.of(context).goalTypeMeals;
492+
case GoalType.basic:
493+
return AppLocalizations.of(context).goalTypeBasic;
494+
case GoalType.advanced:
495+
return AppLocalizations.of(context).goalTypeAdvanced;
496+
}
497+
}
487498
}
488499

489500
class PlanForm extends StatefulWidget {
@@ -572,7 +583,7 @@ class _PlanFormState extends State<PlanForm> {
572583
.map(
573584
(e) => DropdownMenuItem<GoalType>(
574585
value: e,
575-
child: Text(e.label),
586+
child: Text(e.getI18nLabel(context)),
576587
),
577588
)
578589
.toList(),

0 commit comments

Comments
 (0)