Skip to content

Commit 9bd816d

Browse files
authored
🐛 fix locale in account deletion mail (#2600)
1 parent 76ec77f commit 9bd816d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/Mail/AccountDeletionNotificationTwoWeeksBefore.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Illuminate\Mail\Mailables\Content;
99
use Illuminate\Mail\Mailables\Envelope;
1010
use Illuminate\Queue\SerializesModels;
11-
use Illuminate\Support\Facades\App;
1211

1312
class AccountDeletionNotificationTwoWeeksBefore extends Mailable
1413
{
@@ -18,16 +17,19 @@ class AccountDeletionNotificationTwoWeeksBefore extends Mailable
1817

1918
public function __construct(User $user) {
2019
$this->user = $user;
20+
$this->locale(str_starts_with($user->language, 'de') ? 'de' : 'en'); //other languages currently don't have a translation here and (bug?) fall back to the default locale doesn't work?
2121
}
2222

2323
public function envelope(): Envelope {
2424
return new Envelope(
25-
subject: __(key: 'mail.account_deletion_notification_two_weeks_before.subject', locale: $this->user?->language),
25+
subject: __(
26+
key: 'mail.account_deletion_notification_two_weeks_before.subject',
27+
locale: str_starts_with($this->user->language, 'de') ? 'de' : 'en'
28+
),
2629
);
2730
}
2831

2932
public function content(): Content {
30-
App::setLocale($this->user?->language ?? config('app.locale', 'en'));
3133
return new Content(
3234
view: 'mail.account_deletion_notification_two_weeks_before',
3335
with: [

0 commit comments

Comments
 (0)