Skip to content

Commit

Permalink
AN-48 : add more i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
Iankk committed Jul 2, 2021
1 parent 2e7c044 commit dfd5296
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class _AsociationActionCardState extends State<AssociationActionCard> {
onPressed: () => showModalBottomSheet(
context: context,
builder: (context) => DeleteObjectConfirmationDialog(
"Are you sure to delete this action ?",
AppLocalizations.of(context)!.delete_alert_action,
null,
this.widget._action),
),
Expand Down
29 changes: 19 additions & 10 deletions lib/components/associations_actions/create_action_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:assosnation_app/components/posts/post_main_subtitle.dart';
import 'package:assosnation_app/components/posts/post_main_title.dart';
import 'package:assosnation_app/services/firebase/firestore/association_actions_service.dart';
import 'package:assosnation_app/services/models/association_action.dart';
import 'package:assosnation_app/utils/imports/commons.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:date_time_picker/date_time_picker.dart';
import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -46,7 +47,10 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
AssociationActionsService()
.createAssociationActionForAssociation(action);
Navigator.pop(context);
_displaySnackBarWithMessage("Your post has been created", Colors.green);
_displaySnackBarWithMessage(
//TODO change that
AppLocalizations.of(context)!.post_created,
Colors.green);
}
}
}
Expand Down Expand Up @@ -74,11 +78,12 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
PostMainTitle("Editing post"),
PostMainTitle(AppLocalizations.of(context)!.editing_post),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
PostMainSubtitle("Title : "),
PostMainSubtitle(
AppLocalizations.of(context)!.title_label),
Expanded(
child: TextFormField(
maxLength: 30,
Expand All @@ -100,7 +105,7 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("city : "),
PostMainSubtitle(AppLocalizations.of(context)!.city),
Expanded(
child: TextFormField(
maxLength: 30,
Expand All @@ -123,7 +128,8 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Postal code : "),
PostMainSubtitle(
AppLocalizations.of(context)!.postalcode),
Expanded(
child: TextFormField(
maxLength: 5,
Expand All @@ -146,7 +152,7 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Address : "),
PostMainSubtitle(AppLocalizations.of(context)!.address),
Expanded(
child: TextFormField(
maxLength: 50,
Expand All @@ -169,7 +175,8 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Description : "),
PostMainSubtitle(
AppLocalizations.of(context)!.description), //TODO int
Expanded(
child: TextFormField(
maxLength: 150,
Expand Down Expand Up @@ -219,7 +226,8 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Start date : "),
PostMainSubtitle(
AppLocalizations.of(context)!.start_date),
Expanded(
child: DateTimePicker(
type: DateTimePickerType.dateTime,
Expand All @@ -241,7 +249,7 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("End date : "),
PostMainSubtitle(AppLocalizations.of(context)!.end_date),
Expanded(
child: DateTimePicker(
type: DateTimePickerType.dateTime,
Expand All @@ -265,7 +273,8 @@ class _CreateActionDialogState extends State<CreateActionDialog> {
children: [
OutlinedButton(
onPressed: () => Navigator.pop(context),
child: Text("Cancel",
child: Text(
AppLocalizations.of(context)!.cancel_button_label,
style: TextStyle(color: Colors.red))),
OutlinedButton(
onPressed: _verifyAndValidateForm,
Expand Down
31 changes: 19 additions & 12 deletions lib/components/associations_actions/edit_action_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:assosnation_app/components/posts/post_main_subtitle.dart';
import 'package:assosnation_app/components/posts/post_main_title.dart';
import 'package:assosnation_app/services/firebase/firestore/association_actions_service.dart';
import 'package:assosnation_app/services/models/association_action.dart';
import 'package:assosnation_app/utils/imports/commons.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:date_time_picker/date_time_picker.dart';
import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -47,7 +48,8 @@ class _EditActionDialogState extends State<EditActionDialog> {
AssociationActionsService()
.updateAssociationAction(widget._action, newAction);
Navigator.pop(context);
_displaySnackBarWithMessage("Your post has been updated", Colors.green);
_displaySnackBarWithMessage(
AppLocalizations.of(context)!.post_updated, Colors.green);
}
}
}
Expand Down Expand Up @@ -75,11 +77,12 @@ class _EditActionDialogState extends State<EditActionDialog> {
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
PostMainTitle("Editing post"),
PostMainTitle(AppLocalizations.of(context)!.editing_post),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
PostMainSubtitle("Title : "),
PostMainSubtitle(
AppLocalizations.of(context)!.title_label),
Expanded(
child: TextFormField(
maxLength: 30,
Expand All @@ -101,7 +104,7 @@ class _EditActionDialogState extends State<EditActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("city : "),
PostMainSubtitle(AppLocalizations.of(context)!.city),
Expanded(
child: TextFormField(
maxLength: 30,
Expand All @@ -124,7 +127,8 @@ class _EditActionDialogState extends State<EditActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Postal code : "),
PostMainSubtitle(
AppLocalizations.of(context)!.postalcode),
Expanded(
child: TextFormField(
maxLength: 5,
Expand All @@ -147,7 +151,7 @@ class _EditActionDialogState extends State<EditActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Address : "),
PostMainSubtitle(AppLocalizations.of(context)!.address),
Expanded(
child: TextFormField(
maxLength: 50,
Expand All @@ -170,7 +174,8 @@ class _EditActionDialogState extends State<EditActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Description : "),
PostMainSubtitle(
AppLocalizations.of(context)!.description),
Expanded(
child: TextFormField(
maxLength: 150,
Expand All @@ -193,7 +198,7 @@ class _EditActionDialogState extends State<EditActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
PostMainSubtitle("Type : "),
PostMainSubtitle(AppLocalizations.of(context)!.type),
Expanded(
child: DropdownButton(
value: _type,
Expand All @@ -220,7 +225,8 @@ class _EditActionDialogState extends State<EditActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Start date : "),
PostMainSubtitle(
AppLocalizations.of(context)!.start_date),
Expanded(
child: DateTimePicker(
type: DateTimePickerType.dateTime,
Expand All @@ -242,7 +248,7 @@ class _EditActionDialogState extends State<EditActionDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("End date : "),
PostMainSubtitle(AppLocalizations.of(context)!.end_date),
Expanded(
child: DateTimePicker(
type: DateTimePickerType.dateTime,
Expand All @@ -266,12 +272,13 @@ class _EditActionDialogState extends State<EditActionDialog> {
children: [
OutlinedButton(
onPressed: () => Navigator.pop(context),
child: Text("Cancel",
child: Text(
AppLocalizations.of(context)!.cancel_button_label,
style: TextStyle(color: Colors.red))),
OutlinedButton(
onPressed: _verifyAndValidateForm,
child: Text(
"Confirm",
AppLocalizations.of(context)!.confirm_button_label,
style: TextStyle(color: Colors.teal),
)),
],
Expand Down
5 changes: 3 additions & 2 deletions lib/components/dialog/association_informations_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:assosnation_app/components/posts/post_main_title.dart';
import 'package:assosnation_app/services/models/association.dart';
import 'package:assosnation_app/utils/imports/commons.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

Expand All @@ -16,7 +17,7 @@ class AssociationInformationsDialog extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
PostMainTitle("Informations"),
PostMainTitle(AppLocalizations.of(context)!.global_infos_label),
Row(
children: [
Icon(
Expand Down Expand Up @@ -67,7 +68,7 @@ class AssociationInformationsDialog extends StatelessWidget {
children: [
OutlinedButton.icon(
icon: Icon(CupertinoIcons.clear),
label: Text("Close"),
label: Text(AppLocalizations.of(context)!.close_label),
onPressed: () => Navigator.pop(context),
),
],
Expand Down
6 changes: 4 additions & 2 deletions lib/components/dialog/delete_confirmation_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:assosnation_app/services/firebase/firestore/association_actions_service.dart';
import 'package:assosnation_app/services/firebase/firestore/posts_service.dart';
import 'package:assosnation_app/services/models/association_action.dart';
import 'package:assosnation_app/utils/imports/commons.dart';
import 'package:flutter/material.dart';

class DeleteObjectConfirmationDialog extends StatelessWidget {
Expand Down Expand Up @@ -36,7 +37,7 @@ class DeleteObjectConfirmationDialog extends StatelessWidget {
OutlinedButton(
onPressed: () => Navigator.pop(context),
child: Text(
"Cancel",
AppLocalizations.of(context)!.cancel_button_label,
style: TextStyle(color: Colors.teal),
)),
OutlinedButton(
Expand All @@ -49,7 +50,8 @@ class DeleteObjectConfirmationDialog extends StatelessWidget {
}
Navigator.pop(context);
},
child: Text("Delete", style: TextStyle(color: Colors.red))),
child: Text(AppLocalizations.of(context)!.delete_button,
style: TextStyle(color: Colors.red))),
],
)
],
Expand Down
16 changes: 9 additions & 7 deletions lib/components/edit_asso_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:assosnation_app/components/posts/post_main_subtitle.dart';
import 'package:assosnation_app/services/firebase/firestore/association_service.dart';
import 'package:assosnation_app/services/models/association.dart';
import 'package:assosnation_app/utils/imports/commons.dart';
import 'package:assosnation_app/utils/utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -42,12 +43,12 @@ class _EditAssoDetailsState extends State<EditAssoDialog> {
}
if (res == true) {
Navigator.pop(context);
Utils.displaySnackBarWithMessage(
context, "Infos has been updated ! ", Colors.green);
Utils.displaySnackBarWithMessage(context,
AppLocalizations.of(context)!.infos_updated, Colors.green);
} else {
Navigator.pop(context);
Utils.displaySnackBarWithMessage(context,
"Something wrong happened, please try again", Colors.red);
AppLocalizations.of(context)!.error_no_infos, Colors.red);
}
}
}
Expand Down Expand Up @@ -101,7 +102,7 @@ class _EditAssoDetailsState extends State<EditAssoDialog> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostMainSubtitle("Content : "),
PostMainSubtitle(AppLocalizations.of(context)!.content_label),
Expanded(
child: TextFormField(
maxLength: _selectMaxCharacters(),
Expand All @@ -126,12 +127,13 @@ class _EditAssoDetailsState extends State<EditAssoDialog> {
children: [
OutlinedButton(
onPressed: () => Navigator.pop(context),
child:
Text("Cancel", style: TextStyle(color: Colors.red))),
child: Text(
AppLocalizations.of(context)!.cancel_button_label,
style: TextStyle(color: Colors.red))),
OutlinedButton(
onPressed: _verifyAndValidateForm,
child: Text(
"Confirm",
AppLocalizations.of(context)!.confirm_button_label,
style: TextStyle(color: Colors.teal),
)),
],
Expand Down
5 changes: 4 additions & 1 deletion lib/components/messaging/send_message_form.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:assosnation_app/services/firebase/firestore/messaging_service.dart';
import 'package:assosnation_app/utils/imports/commons.dart';
import 'package:assosnation_app/utils/utils.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
Expand All @@ -25,7 +26,9 @@ class _SendMessageFormState extends State<SendMessageForm> {
widget.convId, widget.sender, _msgToSend);
if (!res)
Utils.displaySnackBarWithMessage(
context, "Couldn't send your message", Colors.deepOrange);
context,
AppLocalizations.of(context)!.error_sending_message,
Colors.deepOrange);
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion lib/components/news_feed_like_component.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:assosnation_app/services/firebase/firestore/firestore_service.dart';
import 'package:assosnation_app/services/models/user.dart';
import 'package:assosnation_app/utils/imports/commons.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -59,7 +60,9 @@ class _NewsFeedLikeComponentState extends State<NewsFeedLikeComponent> {
icon: Icon(this.widget._userLiked
? Icons.thumb_up_alt_rounded
: Icons.thumb_up_alt_outlined),
label: Text(this.widget._userLiked ? "Liked !" : "Like")),
label: Text(this.widget._userLiked
? AppLocalizations.of(context)!.post_liked
: AppLocalizations.of(context)!.like_post)),
],
);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/components/posts/create_post_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ class _CreatePostDialogState extends State<CreatePostDialog> {
setState(() {
_title = "";
_content = "";
Utils.displaySnackBarWithMessage(
context, "Your post has been updated", Colors.green);
Utils.displaySnackBarWithMessage(context,
AppLocalizations.of(context)!.post_updated, Colors.green);
});
} else {
Navigator.pop(context);
Utils.displaySnackBarWithMessage(context,
"Something wrong happened, please try again", Colors.red);
AppLocalizations.of(context)!.error_no_infos, Colors.red);
}
}
}
Expand All @@ -55,7 +55,7 @@ class _CreatePostDialogState extends State<CreatePostDialog> {
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
FormMainTitle("Creating a post"),
FormMainTitle(AppLocalizations.of(context)!.post_creating),
Row(
children: [
FormSubTitle(
Expand Down
Loading

0 comments on commit dfd5296

Please sign in to comment.