-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Description
When receiving a notification sent from a project the template content of the email is not in my communication preferred language.
goteo/src/Goteo/Model/Mail.php
Lines 268 to 299 in a59c2a2
| static public function createFromTemplate( | |
| string $to, | |
| string $to_name, | |
| string $template, | |
| array $vars =[], | |
| string $lang = null | |
| { | |
| $mail = new static(); | |
| $mail->to = $to; | |
| $mail->toName = $to_name; | |
| $mail->html = true; | |
| if($to == 'any') $mail->massive = true; | |
| // Obtenemos la plantilla para asunto y contenido | |
| if(empty($lang)) $mail->lang = Lang::current(); | |
| $tpl = Template::get($template, $lang); | |
| // Sustituimos los datos | |
| $mail->subject = $tpl->title; | |
| $mail->template = $tpl->id; | |
| $text = $tpl->text; | |
| $mail->content = $text; | |
| // En el contenido: | |
| if($vars) { | |
| $mail->content = str_replace(array_keys($vars), array_values($vars), $mail->content); | |
| $mail->subject = str_replace(array_keys($vars), array_values($vars), $mail->subject); | |
| } | |
| $mail->lang = $lang; | |
| return $mail; | |
| } |
As we can see in the code it takes the template using the $lang of the user doing the action, not the user receiving it.
Metadata
Metadata
Assignees
Labels
No labels