Skip to content

Commit

Permalink
Store the current locale when serializing mail data in the queue (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Towers authored Oct 13, 2020
2 parents e2ed5fb + 8d4ee39 commit 549895c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Mail/Mailable.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace October\Rain\Mail;

use App;
use Illuminate\Mail\Mailable as MailableBase;

/**
Expand Down Expand Up @@ -47,6 +48,13 @@ public function buildViewData()
*/
public function withSerializedData($data)
{
// Ensure that the current locale is stored with the rest of the data for proper translation of queued messages
$defaultData = [
'_current_locale' => App::getLocale(),
];

$data = array_merge($defaultData, $data);

foreach ($data as $param => $value) {
$this->viewData[$param] = $this->getSerializedPropertyValue($value);
}
Expand Down

0 comments on commit 549895c

Please sign in to comment.