From 47cff8cc6e1b439f96d4f1216cc9e59bbb8ff969 Mon Sep 17 00:00:00 2001 From: Aurelien Roy Date: Fri, 27 Sep 2019 13:04:39 +0200 Subject: [PATCH 1/2] Frontend translation proof of concept --- components/account/register.htm | 20 ++++++++++---------- lang/en/lang.php | 4 ++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/components/account/register.htm b/components/account/register.htm index e6cdef0f..3c28c812 100644 --- a/components/account/register.htm +++ b/components/account/register.htm @@ -1,51 +1,51 @@ {% if canRegister %} -

Register

+

{{ 'rainlab.user::lang.account.register'|trans }}

{{ form_ajax('onRegister') }}
- + + placeholder="{{ 'rainlab.user::lang.account.full_name_placeholder'|trans }}" />
- + + placeholder="{{ 'rainlab.user::lang.account.email_placeholder'|trans }}" />
{% if loginAttribute == "username" %}
- + + placeholder="{{ 'rainlab.user::lang.account.username_placeholder'|trans }}" />
{% endif %}
- + + placeholder="{{ 'rainlab.user::lang.account.password_placeholder'|trans }}" />
- + {{ form_close() }} {% else %} diff --git a/lang/en/lang.php b/lang/en/lang.php index 7bcfda7c..21ce3f0b 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -190,6 +190,10 @@ 'email' => 'Email', 'password' => 'Password', 'login' => 'Login', + 'username_placeholder' => 'Enter your username', + 'email_placeholder' => 'Enter your email', + 'full_name_placeholder' => 'Enter your full name', + 'password_placeholder' => 'Choose a password', 'new_password' => 'New Password', 'new_password_confirm' => 'Confirm New Password', 'update_requires_password' => 'Confirm password on update', From d1c7bd4f00fc6b85ffd7aa834e9567fc70fa8c51 Mon Sep 17 00:00:00 2001 From: Aurelien Roy Date: Fri, 25 Oct 2019 14:27:11 +0200 Subject: [PATCH 2/2] Add localization for components --- components/account/activation_check.htm | 6 +++--- components/account/deactivate_link.htm | 17 ++++++++------- components/account/default.htm | 2 +- components/account/register.htm | 20 +++++++++--------- components/account/signin.htm | 10 ++++----- components/account/update.htm | 13 ++++++------ components/resetpassword/complete.htm | 2 +- components/resetpassword/reset.htm | 12 +++++------ components/resetpassword/restore.htm | 9 ++++---- lang/en/lang.php | 28 +++++++++++++++++++++---- 10 files changed, 71 insertions(+), 48 deletions(-) diff --git a/components/account/activation_check.htm b/components/account/activation_check.htm index 50308331..4bf5f64f 100644 --- a/components/account/activation_check.htm +++ b/components/account/activation_check.htm @@ -1,9 +1,9 @@ {% if not user.is_activated %} -

Your email address has not yet been verified.

+

{# Your email address has not yet been verified. #}{{ 'rainlab.user::lang.account.activation_pending_title' | trans }}

- You should verify your account otherwise it may be deleted. Please check your email to verify. - Send the verification email again. + {# You should verify your account otherwise it may be deleted. Please check your email to verify. #}{{ 'rainlab.user::lang.account.activation_pending_description' | trans }} + {# Send the verification email again #}{{ 'rainlab.user::lang.account.activation_send_again' | trans }}.

{% endif %} \ No newline at end of file diff --git a/components/account/deactivate_link.htm b/components/account/deactivate_link.htm index f96071d7..f8d39702 100644 --- a/components/account/deactivate_link.htm +++ b/components/account/deactivate_link.htm @@ -1,28 +1,29 @@ - Deactivate account + {# Deactivate account #}{{ 'rainlab.user::lang.account.deactivation_label' | trans }} diff --git a/components/account/default.htm b/components/account/default.htm index ddc10c2a..81dcc069 100644 --- a/components/account/default.htm +++ b/components/account/default.htm @@ -3,7 +3,7 @@
-

Sign in

+

{# Sign In #}{{ 'rainlab.user::lang.account.sign_in' | trans }}

{% partial __SELF__ ~ '::signin' %}
diff --git a/components/account/register.htm b/components/account/register.htm index 3c28c812..db4d08af 100644 --- a/components/account/register.htm +++ b/components/account/register.htm @@ -1,51 +1,51 @@ {% if canRegister %} -

{{ 'rainlab.user::lang.account.register'|trans }}

+

{# Register #}{{ 'rainlab.user::lang.account.register' | trans }}

{{ form_ajax('onRegister') }}
- + + placeholder="{# Enter your full name #}{{ 'rainlab.user::lang.account.full_name_placeholder' | trans }}" />
- + + placeholder="{# Enter your email #}{{ 'rainlab.user::lang.account.email_placeholder' | trans }}" />
{% if loginAttribute == "username" %}
- + + placeholder="{# Enter your username #}{{ 'rainlab.user::lang.account.username_placeholder' | trans }}" />
{% endif %}
- + + placeholder="{# Choose a password #}{{ 'rainlab.user::lang.account.choose_password_placeholder' | trans }}" />
- + {{ form_close() }} {% else %} diff --git a/components/account/signin.htm b/components/account/signin.htm index 1e34d838..0d8a930e 100644 --- a/components/account/signin.htm +++ b/components/account/signin.htm @@ -7,27 +7,27 @@ type="text" class="form-control" id="userSigninLogin" - placeholder="Enter your {{ loginAttributeLabel|lower }}" /> + placeholder="{# Enter your username/email #}{{ ('rainlab.user::lang.account.' ~ loginAttribute ~ '_placeholder') | trans }}" />
- + + placeholder="{# Enter your password #}{{ 'rainlab.user::lang.account.password_placeholder' | trans }}" />
{% if rememberLoginMode == 'ask' %}
- +
{% endif %} - + {{ form_close() }} diff --git a/components/account/update.htm b/components/account/update.htm index c26563e0..a930ddaa 100644 --- a/components/account/update.htm +++ b/components/account/update.htm @@ -1,33 +1,34 @@ +{{ 'rainlab.user::lang.account.required' | trans | lower }} {{ form_ajax('onUpdate') }}
- +
- +
- +
- +
{% if updateRequiresPassword %}

To change these details, please confirm your current password.

- +
{% endif %} - + {{ form_close() }} diff --git a/components/resetpassword/complete.htm b/components/resetpassword/complete.htm index d0d0baa5..47248329 100644 --- a/components/resetpassword/complete.htm +++ b/components/resetpassword/complete.htm @@ -1 +1 @@ -

Password reset complete, you may now sign in.

\ No newline at end of file +

{# Password reset complete, you may now sign in. #}{{ 'rainlab.user::lang.reset_password.reset_password_complete' | trans }}

\ No newline at end of file diff --git a/components/resetpassword/reset.htm b/components/resetpassword/reset.htm index 78c62da9..2e0ce252 100644 --- a/components/resetpassword/reset.htm +++ b/components/resetpassword/reset.htm @@ -1,19 +1,19 @@

- Please check your email for the activation code. + {# Please check your email for the activation code. #}{{ 'rainlab.user::lang.reset_password.activation_check_notice' | trans }}

- - + +
- - + +
- +
diff --git a/components/resetpassword/restore.htm b/components/resetpassword/restore.htm index e51eb025..90328e0d 100644 --- a/components/resetpassword/restore.htm +++ b/components/resetpassword/restore.htm @@ -1,14 +1,15 @@

- Lost your password? No problem! Enter your email address to verify your account. + {# Lost your password? #}{{ 'rainlab.user::lang.reset_password.reset_password_title' | trans }} + {# No problem! Enter your email address to verify your account. #}{{ 'rainlab.user::lang.reset_password.reset_password_description' | trans }}

- - + +
- +
diff --git a/lang/en/lang.php b/lang/en/lang.php index 21ce3f0b..7cdcdd4a 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -193,17 +193,37 @@ 'username_placeholder' => 'Enter your username', 'email_placeholder' => 'Enter your email', 'full_name_placeholder' => 'Enter your full name', - 'password_placeholder' => 'Choose a password', + 'password_placeholder' => 'Enter your password', + 'choose_password_placeholder' => 'Choose a password', 'new_password' => 'New Password', + 'new_password_placeholder' => 'Enter a new password', 'new_password_confirm' => 'Confirm New Password', 'update_requires_password' => 'Confirm password on update', - 'update_requires_password_comment' => 'Require the current password of the user when changing their profile.' + 'update_requires_password_comment' => 'Require the current password of the user when changing their profile.', + 'stay_logged_in' => 'Stay logged in', + 'required' => 'Required', + 'type_password_to_continue' => 'To continue, please enter your password:', + 'activation_pending_title' => 'Your email address has not yet been verified.', + 'activation_pending_description' => 'You should verify your account otherwise it may be deleted. Please check your email to verify.', + 'activation_send_again' => 'Send the verification email again', + 'deactivation_label' => 'Deactivate account', + 'deactivation_title' => 'Deactivate your account?', + 'deactivation_description' => 'Your account will be disabled and your details removed from the site. You can reactivate your account any time by signing back in.', + 'deactivation_confirm' => 'Confirm Deactivate Account', + 'deactivation_cancel' => 'I changed my mind' ], 'reset_password' => [ 'reset_password' => 'Reset Password', 'reset_password_desc' => 'Forgotten password form.', 'code_param' => 'Reset Code Param', - 'code_param_desc' => 'The page URL parameter used for the reset code' + 'code_param_desc' => 'The page URL parameter used for the reset code', + 'reset_password_complete' => 'Password reset complete, you may now sign in.', + 'activation_code' => 'Activation code', + 'activation_code_placeholder' => 'Enter the activation code', + 'activation_check_notice' => 'Please check your email for the activation code.', + 'reset_password_title' => 'Lost your password?', + 'reset_password_description' => 'No problem! Enter your email address to verify your account.', + 'restore_password' => 'Restore password' ], 'session' => [ 'session' => 'Session', @@ -219,5 +239,5 @@ 'redirect_desc' => 'Page name to redirect if access is denied.', 'logout' => 'You have been successfully logged out!', 'stop_impersonate_success' => 'You are no longer impersonating a user.', - ] + ], ];