diff --git a/src/NotificationCenter.php b/src/NotificationCenter.php index e7ba90d..5345ad3 100644 --- a/src/NotificationCenter.php +++ b/src/NotificationCenter.php @@ -363,9 +363,11 @@ public function createBasicStampsForNotification(int $id, TokenCollection|array $stamps = new StampCollection([new NotificationConfigStamp($notificationConfig)]); if (null === $locale && ($request = $this->requestStack->getCurrentRequest()) instanceof Request) { - $stamps = $stamps - ->with(new LocaleStamp(LocaleUtil::formatAsLocale($request->getLocale()))) - ; + $locale = $request->getLocale(); + } + + if ($locale) { + $stamps = $stamps->with(new LocaleStamp(LocaleUtil::formatAsLocale($locale))); } if (!$tokens instanceof TokenCollection) {