Internal: In legacy get_lang and templates isn't necessary to force the locale - refs BT#21304

The locale is set in request
pull/5031/head
Angel Fernando Quiroz Campos 2 years ago
parent 95a41513d6
commit a993c6cfa8
  1. 4
      public/main/inc/lib/internationalization.lib.php
  2. 4
      public/main/inc/lib/usermanager.lib.php
  3. 21
      src/CoreBundle/Resources/views/Mailer/Legacy/content_registration_platform.html.twig
  4. 3
      src/CoreBundle/Resources/views/Mailer/Legacy/subject_registration_platform.html.twig

@ -66,13 +66,11 @@ function get_lang(string $variable): string
// Using symfony
$defaultDomain = 'messages';
$locale = api_get_language_isocode();
return $translator->trans(
$variable,
[],
$defaultDomain,
$locale
$defaultDomain
);
}

@ -248,7 +248,6 @@ class UserManager
$language = 'en_US';
}
$locale = substr($language, 0, 2);
$now = new DateTime();
if (empty($expirationDate) || '0000-00-00 00:00:00' === $expirationDate) {
$expirationDate = null;
@ -378,7 +377,7 @@ class UserManager
PERSON_NAME_EMAIL_ADDRESS
);
$tpl = Container::getTwig();
$emailSubject = $tpl->render('@ChamiloCore/Mailer/Legacy/subject_registration_platform.html.twig', ['locale' => $locale]);
$emailSubject = $tpl->render('@ChamiloCore/Mailer/Legacy/subject_registration_platform.html.twig');
$sender_name = api_get_person_name(
api_get_setting('administratorName'),
api_get_setting('administratorSurname'),
@ -406,7 +405,6 @@ class UserManager
'mailWebPath' => $url,
'new_user' => $user,
'search_link' => $url,
'locale' => $locale,
];
// ofaj

@ -1,22 +1,21 @@
{% autoescape false %}
{% set locale = locale|default('en') %}
<p>{{ 'Dear'|trans({}, null, locale) }} {{ complete_name }},</p>
<p>{{ 'Welcome to this platform'|trans({}, null, locale) }}</p>
<p>{{ 'You are registered to'|trans({}, null, locale) }} {{ 'platform.site_name' | api_get_setting }} {{ 'with the following settings:'|trans({}, null, locale) }}</p>
<p>{{ 'Username'|trans({}, null, locale) }} : {{ login_name }}<br>
{{ 'Pass'|trans({}, null, locale) }} : {{ original_password }}</p>
<p>{{ 'For more details visit %s'|trans({}, null, locale)|format(search_link) }}</p>
<p>{{ 'In case of trouble, contact us.'|trans({}, null, locale) }}</p>
<p>{{ 'Dear'|trans }} {{ complete_name }},</p>
<p>{{ 'Welcome to this platform'|trans }}</p>
<p>{{ 'You are registered to'|trans }} {{ 'platform.site_name' | api_get_setting }} {{ 'with the following settings:'|trans }}</p>
<p>{{ 'Username'|trans }} : {{ login_name }}<br>
{{ 'Pass'|trans }} : {{ original_password }}</p>
<p>{{ 'For more details visit %s'|trans|format(search_link) }}</p>
<p>{{ 'In case of trouble, contact us.'|trans }}</p>
<p>{{ 'Sincerely'|trans({}, null, locale) }}</p>
<p>{{ 'Sincerely'|trans }}</p>
<p>{{ 'admin.administrator_name' | api_get_setting }} {{ 'admin.administrator_surname' | api_get_setting }}<br />
{{ 'Manager'|trans({}, null, locale) }} {{ 'platform.site_name' | api_get_setting }}<br />
{{ 'Manager'|trans }} {{ 'platform.site_name' | api_get_setting }}<br />
{% if 'admin.administrator_phone' | api_get_setting %}
{{ 'T. ' ~ 'admin.administrator_phone' | api_get_setting }}<br />
{% endif %}
{% if 'admin.administrator_email' | api_get_setting %}
{{ 'Email'|trans({}, null, locale) ~ ': ' ~ 'admin.administrator_email' | api_get_setting }}
{{ 'Email'|trans ~ ': ' ~ 'admin.administrator_email' | api_get_setting }}
{% endif %}
</p>
{% endautoescape %}

@ -1,2 +1 @@
{% set locale = locale|default('en') %}
{{ '['~ 'platform.site_name' | api_get_setting ~ '] ' ~ 'Your Reg'|trans({}, null, locale) ~ ' ' ~ 'platform.site_name' | api_get_setting }}
{{ '['~ 'platform.site_name' | api_get_setting ~ '] ' ~ 'Your Reg'|trans ~ ' ' ~ 'platform.site_name' | api_get_setting }}

Loading…
Cancel
Save