diff --git a/public/main/auth/inscription.php b/public/main/auth/inscription.php index a2fb8cc15a..a9b148cc0a 100644 --- a/public/main/auth/inscription.php +++ b/public/main/auth/inscription.php @@ -1171,9 +1171,9 @@ if ($form->validate()) { $recipient_name = api_get_person_name($values['firstname'], $values['lastname']); $textAfterRegistration = '

'. - get_lang('Dear').' '. + get_lang('Dear', $userEntity->getLocale()).' '. stripslashes(Security::remove_XSS($recipient_name)).',

'. - get_lang('Your personal settings have been registered')."

"; + get_lang('Your personal settings have been registered', $userEntity->getLocale())."

"; $formData = [ 'button' => Display::button( @@ -1205,11 +1205,11 @@ if ($form->validate()) { } else { if (!empty($values['email'])) { $linkDiagnostic = api_get_path(WEB_PATH).'main/search/search.php'; - $textAfterRegistration .= '

'.get_lang('An e-mail has been sent to remind you of your login and password').'

'; + $textAfterRegistration .= '

'.get_lang('An e-mail has been sent to remind you of your login and password', $userEntity->getLocale()).'

'; $diagnosticPath = ''.$linkDiagnostic.''; $textAfterRegistration .= '

'; $textAfterRegistration .= sprintf( - get_lang('Welcome, please go to diagnostic at %s.'), + get_lang('Welcome, please go to diagnostic at %s.', $userEntity->getLocale()), $diagnosticPath ); $textAfterRegistration .= '

'; diff --git a/public/main/inc/lib/usermanager.lib.php b/public/main/inc/lib/usermanager.lib.php index ea951bbd16..f5a3d7d378 100644 --- a/public/main/inc/lib/usermanager.lib.php +++ b/public/main/inc/lib/usermanager.lib.php @@ -315,6 +315,7 @@ class UserManager $userId = $user->getId(); if (!empty($userId)) { + $userLocale = $user->getLocale(); if ($isAdmin) { self::addUserAsAdmin($user); } @@ -377,7 +378,7 @@ class UserManager PERSON_NAME_EMAIL_ADDRESS ); $tpl = Container::getTwig(); - $emailSubject = $tpl->render('@ChamiloCore/Mailer/Legacy/subject_registration_platform.html.twig'); + $emailSubject = $tpl->render('@ChamiloCore/Mailer/Legacy/subject_registration_platform.html.twig', ['locale' => $userLocale]); $sender_name = api_get_person_name( api_get_setting('administratorName'), api_get_setting('administratorSurname'), @@ -405,6 +406,7 @@ class UserManager 'mailWebPath' => $url, 'new_user' => $user, 'search_link' => $url, + 'locale' => $userLocale, ]; // ofaj diff --git a/src/CoreBundle/Resources/views/Mailer/Legacy/content_registration_platform.html.twig b/src/CoreBundle/Resources/views/Mailer/Legacy/content_registration_platform.html.twig index 76f8e594ef..86fa84ea5f 100644 --- a/src/CoreBundle/Resources/views/Mailer/Legacy/content_registration_platform.html.twig +++ b/src/CoreBundle/Resources/views/Mailer/Legacy/content_registration_platform.html.twig @@ -1,21 +1,24 @@ +{% set user_locale = locale is defined ? locale : 'en' %} +{% trans_default_domain 'messages' %} + {% autoescape false %} -

{{ 'Dear'|trans }} {{ complete_name }},

-

{{ 'Welcome to this platform'|trans }}

-

{{ 'You are registered to'|trans }} {{ 'platform.site_name' | api_get_setting }} {{ 'with the following settings:'|trans }}

-

{{ 'Username'|trans }} : {{ login_name }}
- {{ 'Pass'|trans }} : {{ original_password }}

-

{{ 'For more details visit %s'|trans|format(search_link) }}

-

{{ 'In case of trouble, contact us.'|trans }}

+

{{ 'Dear'|trans({}, 'messages', user_locale) }} {{ complete_name }},

+

{{ 'Welcome to this platform'|trans({}, 'messages', user_locale) }}

+

{{ 'You are registered to'|trans({}, 'messages', user_locale) }} {{ 'platform.site_name' | api_get_setting }} {{ 'with the following settings:'|trans({}, 'messages', user_locale) }}

+

{{ 'Username'|trans({}, 'messages', user_locale) }} : {{ login_name }}
+ {{ 'Pass'|trans({}, 'messages', user_locale) }} : {{ original_password }}

+

{{ 'For more details visit %s'|trans({'%s': search_link}, 'messages', user_locale) }}

+

{{ 'In case of trouble, contact us.'|trans({}, 'messages', user_locale) }}

-

{{ 'Sincerely'|trans }}

+

{{ 'Sincerely'|trans({}, 'messages', user_locale) }}

{{ 'admin.administrator_name' | api_get_setting }} {{ 'admin.administrator_surname' | api_get_setting }}
- {{ 'Manager'|trans }} {{ 'platform.site_name' | api_get_setting }}
+ {{ 'Manager'|trans({}, 'messages', user_locale) }} {{ 'platform.site_name' | api_get_setting }}
{% if 'admin.administrator_phone' | api_get_setting %} {{ 'T. ' ~ 'admin.administrator_phone' | api_get_setting }}
{% endif %} {% if 'admin.administrator_email' | api_get_setting %} - {{ 'Email'|trans ~ ': ' ~ 'admin.administrator_email' | api_get_setting }} + {{ 'Email'|trans({}, 'messages', user_locale) ~ ': ' ~ 'admin.administrator_email' | api_get_setting }} {% endif %}

{% endautoescape %} diff --git a/src/CoreBundle/Resources/views/Mailer/Legacy/subject_registration_platform.html.twig b/src/CoreBundle/Resources/views/Mailer/Legacy/subject_registration_platform.html.twig index b2f670c745..4741c94620 100644 --- a/src/CoreBundle/Resources/views/Mailer/Legacy/subject_registration_platform.html.twig +++ b/src/CoreBundle/Resources/views/Mailer/Legacy/subject_registration_platform.html.twig @@ -1 +1,4 @@ -{{ '['~ 'platform.site_name' | api_get_setting ~ '] ' ~ 'Your Reg'|trans ~ ' ' ~ 'platform.site_name' | api_get_setting }} +{% set user_locale = locale is defined ? locale : 'en' %} +{% trans_default_domain 'messages' %} + +{{ '['~ 'platform.site_name' | api_get_setting ~ '] ' ~ 'Your Reg'|trans({}, 'messages', user_locale) ~ ' ' ~ 'platform.site_name' | api_get_setting }}