Skip to content

Firefly III: a personal finances manager

Fix https://github.com/firefly-iii/firefly-iii/issues/12066

James Cole074ca1756d6b
diff --git a/app/Notifications/NotificationSender.php b/app/Notifications/NotificationSender.php
index 4e134cad51..fdf0177cda 100644
--- a/app/Notifications/NotificationSender.php
+++ b/app/Notifications/NotificationSender.php
@@ -26,6 +26,7 @@ namespace FireflyIII\Notifications;
use Exception;
use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
+use FireflyIII\Support\Facades\Preferences;
use FireflyIII\User;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Notifications\Notification;
@@ -36,8 +37,15 @@ class NotificationSender
{
public static function send(OwnerNotifiable|User $user, Notification $notification): void
{
+ // ::locale($user->locale))
+ $lang = config('firefly.default_language');
+ Log::debug(sprintf('Notification send language defaults to "%s"', $lang));
+ if($user instanceof User) {
+ $lang = Preferences::getForUser($user, 'language', $lang)->data;
+ Log::debug(sprintf('Notification send language set to "%s"', $lang));
+ }
try {
- NotificationFacade::send($user, $notification);
+ NotificationFacade::locale($lang)->send($user, $notification);
} catch (ClientException $e) {
Log::error(sprintf('[a] Error sending notification: %s', $e->getMessage()));
} catch (Exception $e) {
diff --git a/app/Notifications/Test/UserTestNotificationEmail.php b/app/Notifications/Test/UserTestNotificationEmail.php
index 20cb0c81ca..32e22c401c 100644
--- a/app/Notifications/Test/UserTestNotificationEmail.php
+++ b/app/Notifications/Test/UserTestNotificationEmail.php
@@ -48,11 +48,9 @@ class UserTestNotificationEmail extends Notification
public function toMail(User $notifiable): MailMessage
{
$address = (string) $notifiable->email;
+ $link = route('index');
- return new MailMessage()
- ->markdown('emails.admin-test', ['email' => $address])
- ->subject((string) trans('email.admin_test_subject'))
- ;
+ return new MailMessage()->markdown('emails.admin-test', ['email' => $address, 'link' => $link ])->subject((string) trans('email.admin_test_subject'));
}
/**