From 241e4f20063d881b59ef1743f77ae14cf648b43c Mon Sep 17 00:00:00 2001 From: Camille Simiand <camille.simiand@tetras-libre.fr> Date: Tue, 14 Dec 2021 12:15:52 +0100 Subject: [PATCH] Add exhaustive translations --- src/Form/RegistrationFormType.php | 2 +- src/Form/ResetPasswordRequestFormType.php | 2 +- templates/connexion.html.twig | 8 +++-- templates/layout.html.twig | 7 +++-- .../reset_password/check_email.html.twig | 14 ++++++--- templates/reset_password/email.html.twig | 16 +++++++--- templates/reset_password/request.html.twig | 15 ++++++---- templates/reset_password/reset.html.twig | 10 +++++-- templates/security/login.html.twig | 24 ++++++++------- translations/messages.en.yaml | 29 +++++++++++++++++-- 10 files changed, 90 insertions(+), 37 deletions(-) diff --git a/src/Form/RegistrationFormType.php b/src/Form/RegistrationFormType.php index cabe1d4..6985979 100644 --- a/src/Form/RegistrationFormType.php +++ b/src/Form/RegistrationFormType.php @@ -44,7 +44,7 @@ class RegistrationFormType extends AbstractType EmailType::class, [ 'constraints' => [new NotBlank(['message' => 'email.not_blank'])], - 'label' => 'registration.email' + 'label' => 'general.email' ] ) ->add('plainPassword', RepeatedType::class, [ diff --git a/src/Form/ResetPasswordRequestFormType.php b/src/Form/ResetPasswordRequestFormType.php index 706ba84..3572165 100644 --- a/src/Form/ResetPasswordRequestFormType.php +++ b/src/Form/ResetPasswordRequestFormType.php @@ -20,7 +20,7 @@ class ResetPasswordRequestFormType extends AbstractType 'message' => 'email.not_blank', ]), ], - 'label' => 'reset_password.email' + 'label' => 'general.email' ]) ; } diff --git a/templates/connexion.html.twig b/templates/connexion.html.twig index d53a065..caa9374 100644 --- a/templates/connexion.html.twig +++ b/templates/connexion.html.twig @@ -2,7 +2,11 @@ {% block connexion %} <div class="d-flex flex-row justify-content-center mb-10"> - <a href="/login" class="btn btn-primary m-2 px-4 py-3" >LOG IN</a> - <a href="/register" class="btn btn-primary m-2 px-4 py-3" >SIGN IN</a> + <a href="/login" class="btn btn-primary m-2 px-4 py-3 text-uppercase" > + {{ 'login.log_in'|trans }} + </a> + <a href="/register" class="btn btn-primary m-2 px-4 py-3 text-uppercase"> + {{ 'general.sign_in'|trans }} + </a> </div> {% endblock %} diff --git a/templates/layout.html.twig b/templates/layout.html.twig index 758ed75..999ce4f 100644 --- a/templates/layout.html.twig +++ b/templates/layout.html.twig @@ -3,8 +3,7 @@ <head> <meta charset="UTF-8"> <title>{% block title %}MemoRekall{% endblock %}</title> - {# Run `composer require symfony/webpack-encore-bundle` - and uncomment the following Encore helpers to start using Symfony UX #} + {% block stylesheets %} {{ encore_entry_link_tags('app') }} {% endblock %} @@ -27,7 +26,9 @@ <div id="user-block"> <div id="user-block-nom">{{ app.user.firstName }} {{ app.user.lastName }}</div> <form> - <button class="btn btn-primary" formaction="/logout">Log out</button> + <button class="btn btn-primary" formaction="/logout"> + {{ 'general.log_out'|trans }} + </button> </form> </div> {% endif %} diff --git a/templates/reset_password/check_email.html.twig b/templates/reset_password/check_email.html.twig index 1522a61..5dda4cb 100644 --- a/templates/reset_password/check_email.html.twig +++ b/templates/reset_password/check_email.html.twig @@ -1,11 +1,17 @@ {% extends 'layout.html.twig' %} -{% block title %}Password Reset Email Sent{% endblock %} +{% block title %} + {{ 'check_email_reset_password.title'|trans }} +{% endblock %} {% block body %} <p> - If an account matching your email exists, then an email was just sent that contains a link that you can use to reset your password. - This link will expire in {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}. + {{ 'check_email_reset_password.text'|trans }} + {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}. + </p> + <p>{{ 'check_email_reset_password.check_spam'|trans }} + <a href="{{ path('app_forgot_password_request') }}"> + {{ 'check_email_reset_password.try_again'|trans }} + </a> </p> - <p>If you don't receive an email please check your spam folder or <a href="{{ path('app_forgot_password_request') }}">try again</a>.</p> {% endblock %} diff --git a/templates/reset_password/email.html.twig b/templates/reset_password/email.html.twig index 7b470f3..eb11e2a 100644 --- a/templates/reset_password/email.html.twig +++ b/templates/reset_password/email.html.twig @@ -1,9 +1,17 @@ <h1>Hi!</h1> -<p>To reset your password, please visit the following link</p> +<p> + {{ 'email_reset_password.instructions'|trans }} +</p> -<a href="{{ url('app_reset_password', {token: resetToken.token}) }}">Reset my password</a> +<a href="{{ url('app_reset_password', {token: resetToken.token}) }}"> + {{ 'email_reset_password.link'|trans }} +</a> -<p>This link will expire in {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}.</p> +<p> + {{ 'email_reset_password.link_expire'|trans }} {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}. +</p> -<p>Cheers!</p> +<p> + {{ 'email_reset_password.greeting'|trans }} +</p> diff --git a/templates/reset_password/request.html.twig b/templates/reset_password/request.html.twig index 24b3509..5cc417e 100644 --- a/templates/reset_password/request.html.twig +++ b/templates/reset_password/request.html.twig @@ -1,12 +1,16 @@ {% extends 'layout.html.twig' %} -{% block title %}Reset your password{% endblock %} +{% block title %} + {{ 'reset_password.title'|trans }} +{% endblock %} {% block body %} {% for flashError in app.flashes('reset_password_error') %} <div class="alert alert-danger" role="alert">{{ flashError }}</div> {% endfor %} - <h1 class="m-auto mb-4 mt-4 col-6">Reset your password</h1> + <h1 class="m-auto mb-4 mt-4 col-6"> + {{ 'reset_password.title'|trans }} + </h1> <div class="d-flex flex-column justify-content-center"> @@ -17,12 +21,13 @@ <div class="m-auto mb-4 mt-4 col-6"> <small> - Enter your email address and we will send you a - link to reset your password. + {{ 'reset_password.message'|trans }} </small> </div> - <button class="d-flex flex-column btn btn-primary m-auto mt-2 mb-4 col-2" type="submit">Reset password</button> + <button class="d-flex flex-column btn btn-primary m-auto mt-2 mb-4 col-2" type="submit"> + {{ 'reset_password.button'|trans }} + </button> {{ form_end(requestForm) }} </div> diff --git a/templates/reset_password/reset.html.twig b/templates/reset_password/reset.html.twig index b97a360..820aca2 100644 --- a/templates/reset_password/reset.html.twig +++ b/templates/reset_password/reset.html.twig @@ -1,9 +1,13 @@ {% extends 'layout.html.twig' %} -{% block title %}Reset your password{% endblock %} +{% block title %} + {{ 'reset_password.title'|trans }} +{% endblock %} {% block body %} - <h1 class="m-auto mb-4 col-6">Reset your password</h1> + <h1 class="m-auto mb-4 col-6"> + {{ 'reset_password.title'|trans }} + </h1> <div class="d-flex flex-column justify-content-center"> {{ form_start(resetForm, {'attr': {novalidate: 'novalidate'}}) }} @@ -11,7 +15,7 @@ {{ form_row(resetForm.plainPassword) }} </div> <button class="d-flex flex-column btn btn-primary m-auto mt-2 mb-4 col-2" type="submit"> - Reset password + {{ 'reset_password.button'|trans }} </button> {{ form_end(resetForm) }} </div> diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index cfcfb43..4aef930 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -1,6 +1,8 @@ {% extends 'connexion.html.twig' %} -{% block title %}Log in{% endblock %} +{% block title %} + {{ 'login.log_in'|trans }} +{% endblock %} {% block body %} <form method="post" class="d-flex flex-column justify-content-center"> @@ -11,18 +13,16 @@ <div class="alert alert-warning col-6 m-auto" role="alert" >{{ flashMessage }}</div> {% endfor %} - {% if app.user %} - <div class="mb-3"> - You are logged in as {{ app.user.username }}, <a href="{{ path('app_logout') }}">Logout</a> - </div> - {% endif %} - <div class="form-group d-flex flex-column m-auto mb-4 mt-4 col-6"> - <label for="inputEmail" class="form-label">Email</label> + <label for="inputEmail" class="form-label"> + {{ 'general.email'|trans }} + </label> <input type="email" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" autocomplete="email" required autofocus> </div> <div class="form-group d-flex flex-column m-auto mb-4 col-6"> - <label for="inputPassword" class="form-label">Password</label> + <label for="inputPassword" class="form-label"> + {{ 'general.password'|trans }} + </label> <input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required> </div> @@ -41,10 +41,12 @@ </div> #} - <a href="/reset-password" class="m-auto">I forgot my password</a> + <a href="/reset-password" class="m-auto"> + {{ 'login.forgot_password_link'|trans }} + </a> <button class="btn btn-primary col-2 m-auto mt-4" type="submit"> - Log in + {{ 'login.log_in'|trans }} </button> </form> diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 9cb7836..be3a7d7 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -1,10 +1,17 @@ +general: + email: Email + password: Password + sign_in: Sign in + log_out: Log out + login: account_disabled_feedback: Your user account is disabled. Please click on the link your receive by email to validate your registration. + forgot_password_link: I forgot my password + log_in: Log in registration: firstName: First name lastName: Last name - email: Email password: first: Password second: Repeat Password @@ -12,7 +19,23 @@ registration: agreeTerms: Accept terms and conditions register: Register +#RESET PASSWORD reset_password: - email: Email + title: Reset your password + new_password: New password repeat_password: Repeat password - new_password: New password \ No newline at end of file + message: Enter your email address and we will send you a link to reset your password. + button: Reset password + +check_email_reset_password: + title: Password Reset Email Sent + text: If an account matching your email exists, then an email was just sent that contains a link that you can use to reset your password. + This link will expire in + check_spam: If you don't receive an email please check your spam folder or + try_again: Try again. + +email_reset_password: + instructions: To reset your password, please visit the following link + link: Reset my password + link_expire: This link will expire in + greeting: Cheers! \ No newline at end of file -- GitLab