Skip to content

Commit

Permalink
feat(trad): traduction activated on the services page
Browse files Browse the repository at this point in the history
  • Loading branch information
axel-denis committed Nov 5, 2023
1 parent 96c45ca commit 602a18c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/mobile/lib/components/trad.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

String getLocalizedString(String key, BuildContext context) {
String getAreaTrad(String key, BuildContext context) {
switch (key) {
case "on_new_video":
return AppLocalizations.of(context)!.on_new_video;
Expand Down
11 changes: 9 additions & 2 deletions frontend/mobile/lib/pages/services.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:area_mobile/components/empty_notice.dart';
import 'package:area_mobile/components/services/service_card.dart';
import 'package:area_mobile/components/trad.dart';
import 'package:area_mobile/services/dio.dart';
import 'package:area_mobile/services/services/areas.dart';
import 'package:area_mobile/types/services.dart';
Expand Down Expand Up @@ -157,8 +158,14 @@ class ActionOrReactionItem extends StatelessWidget {
return Card(
elevation: 8,
child: ListTile(
title: Text(item.id),
subtitle: Text(item.description),
title: Text(getAreaTrad(item.id.replaceAll("-", "_"), context) == ""
? item.id
: getAreaTrad(item.id.replaceAll("-", "_"), context)),
subtitle: Text(
getAreaTrad("${item.id.replaceAll("-", "_")}_sub", context) == ""
? item.description
: getAreaTrad(
"${item.id.replaceAll("-", "_")}_sub", context)),
// Add more information if needed
));
}
Expand Down

0 comments on commit 602a18c

Please sign in to comment.