From c51ba11fcb3acea895fb86b5c6091f7a4c3f8d7b Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Thu, 4 Nov 2021 16:13:02 +0100 Subject: [PATCH] chore: Add localizations to signup page --- assets/l10n/intl_en.arb | 9 +++++++++ lib/pages/signup.dart | 6 +++--- lib/pages/views/signup_view.dart | 6 +++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index af504427..a4eac082 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -1,6 +1,15 @@ { "@@locale": "en", "@@last_modified": "2021-08-14 12:38:37.885451", + "passwordsDoNotMatch": "Passwords do not match!", + "pleaseEnterValidEmail": "Please enter a valid email address.", + "repeatPassword": "Repeat password", + "pleaseChooseAtLeastChars": "Please choose at least {min} characters.", + "@pleaseChooseAtLeastChars": { + "type": "text", + "placeholders": { + "min": {}} + }, "about": "About", "@about": { "type": "text", diff --git a/lib/pages/signup.dart b/lib/pages/signup.dart index a6c639a3..744981d1 100644 --- a/lib/pages/signup.dart +++ b/lib/pages/signup.dart @@ -45,7 +45,7 @@ class SignupPageController extends State { return L10n.of(context).chooseAStrongPassword; } if (value.length < minLength) { - return 'Please choose at least $minLength characters.'; + return L10n.of(context).pleaseChooseAtLeastChars(minLength.toString()); } return null; } @@ -55,14 +55,14 @@ class SignupPageController extends State { return L10n.of(context).chooseAStrongPassword; } if (value != passwordController.text) { - return 'Passwords do not match!'; + return L10n.of(context).passwordsDoNotMatch; } return null; } String emailTextFieldValidator(String value) { if (value.isNotEmpty && !value.contains('@')) { - return 'Please enter a valid email address.'; + return L10n.of(context).pleaseEnterValidEmail; } return null; } diff --git a/lib/pages/views/signup_view.dart b/lib/pages/views/signup_view.dart index 84066932..2a563ab0 100644 --- a/lib/pages/views/signup_view.dart +++ b/lib/pages/views/signup_view.dart @@ -73,10 +73,10 @@ class SignupPageView extends StatelessWidget { controller: controller.passwordController2, obscureText: true, validator: controller.password2TextFieldValidator, - decoration: const InputDecoration( - prefixIcon: Icon(Icons.repeat_outlined), + decoration: InputDecoration( + prefixIcon: const Icon(Icons.repeat_outlined), hintText: '****', - labelText: 'Repeat password', + labelText: L10n.of(context).repeatPassword, ), ), ),