From 9080ad063cf369b8c270b54986ca0b3e43a3f60d Mon Sep 17 00:00:00 2001 From: Camille Simiand <camille.simiand@tetras-libre.fr> Date: Mon, 13 Dec 2021 11:27:21 +0100 Subject: [PATCH] Add translations --- src/Form/ChangePasswordFormType.php | 10 +++++----- src/Form/RegistrationFormType.php | 2 +- src/Form/ResetPasswordRequestFormType.php | 3 ++- translations/messages.en.yaml | 7 ++++++- translations/validators.en.yaml | 5 ++--- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/Form/ChangePasswordFormType.php b/src/Form/ChangePasswordFormType.php index 419fe5e..287894d 100644 --- a/src/Form/ChangePasswordFormType.php +++ b/src/Form/ChangePasswordFormType.php @@ -21,22 +21,22 @@ class ChangePasswordFormType extends AbstractType 'attr' => ['autocomplete' => 'new-password'], 'constraints' => [ new NotBlank([ - 'message' => 'Please enter a password', + 'message' => 'password.not_blank', ]), new Length([ 'min' => 6, - 'minMessage' => 'Your password should be at least {{ limit }} characters', + 'minMessage' => 'password.min_characters', // max length allowed by Symfony for security reasons 'max' => 4096, ]), ], - 'label' => 'New password', + 'label' => 'reset_password.new_password', ], 'second_options' => [ 'attr' => ['autocomplete' => 'new-password'], - 'label' => 'Repeat Password', + 'label' => 'reset_password.repeat_password', ], - 'invalid_message' => 'The password fields must match.', + 'invalid_message' => 'password.match', // Instead of being set onto the object directly, // this is read and encoded in the controller 'mapped' => false, diff --git a/src/Form/RegistrationFormType.php b/src/Form/RegistrationFormType.php index 9a8fa83..cabe1d4 100644 --- a/src/Form/RegistrationFormType.php +++ b/src/Form/RegistrationFormType.php @@ -62,7 +62,7 @@ class RegistrationFormType extends AbstractType ], 'first_options' => ['label' => 'registration.password.first'], 'second_options' => ['label' => 'registration.password.second'], - 'invalid_message' => 'invalid_message' + 'invalid_message' => 'password.match' ]) ->add( 'captcha', diff --git a/src/Form/ResetPasswordRequestFormType.php b/src/Form/ResetPasswordRequestFormType.php index 939ea5f..706ba84 100644 --- a/src/Form/ResetPasswordRequestFormType.php +++ b/src/Form/ResetPasswordRequestFormType.php @@ -17,9 +17,10 @@ class ResetPasswordRequestFormType extends AbstractType 'attr' => ['autocomplete' => 'email'], 'constraints' => [ new NotBlank([ - 'message' => 'Please enter your email', + 'message' => 'email.not_blank', ]), ], + 'label' => 'reset_password.email' ]) ; } diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index c5f2227..9cb7836 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -10,4 +10,9 @@ registration: second: Repeat Password captcha: Captcha agreeTerms: Accept terms and conditions - register: Register \ No newline at end of file + register: Register + +reset_password: + email: Email + repeat_password: Repeat password + new_password: New password \ No newline at end of file diff --git a/translations/validators.en.yaml b/translations/validators.en.yaml index 2ca8f82..838756d 100644 --- a/translations/validators.en.yaml +++ b/translations/validators.en.yaml @@ -10,7 +10,6 @@ email: password: not_blank: Please enter your password min_characters: Your password should be at least {{ limit }} characters + match: The password fields must match. -invalid_message: The password fields must match - -agreeTerms: You must agree with our terms +agreeTerms: You must agree with our terms \ No newline at end of file -- GitLab