|
9 | 9 | use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberBlacklistManager; |
10 | 10 | use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager; |
11 | 11 | use Symfony\Component\HttpFoundation\RequestStack; |
| 12 | +use Symfony\Contracts\Translation\TranslatorInterface; |
12 | 13 |
|
13 | 14 | class SubscriberBlacklistService |
14 | 15 | { |
15 | 16 | private EntityManagerInterface $entityManager; |
16 | 17 | private SubscriberBlacklistManager $blacklistManager; |
17 | 18 | private SubscriberHistoryManager $historyManager; |
18 | 19 | private RequestStack $requestStack; |
| 20 | + private TranslatorInterface $translator; |
19 | 21 |
|
20 | 22 | public function __construct( |
21 | 23 | EntityManagerInterface $entityManager, |
22 | 24 | SubscriberBlacklistManager $blacklistManager, |
23 | 25 | SubscriberHistoryManager $historyManager, |
24 | 26 | RequestStack $requestStack, |
| 27 | + TranslatorInterface $translator, |
25 | 28 | ) { |
26 | 29 | $this->entityManager = $entityManager; |
27 | 30 | $this->blacklistManager = $blacklistManager; |
28 | 31 | $this->historyManager = $historyManager; |
29 | 32 | $this->requestStack = $requestStack; |
| 33 | + $this->translator = $translator; |
30 | 34 | } |
31 | 35 |
|
32 | 36 | /** |
@@ -55,7 +59,7 @@ public function blacklist(Subscriber $subscriber, string $reason): void |
55 | 59 | $this->historyManager->addHistory( |
56 | 60 | subscriber: $subscriber, |
57 | 61 | message: 'Added to blacklist', |
58 | | - details: sprintf('Added to blacklist for reason %s', $reason) |
| 62 | + details: $this->translator->trans('Added to blacklist for reason %reason%', ['%reason%' => $reason]) |
59 | 63 | ); |
60 | 64 |
|
61 | 65 | if (isset($GLOBALS['plugins']) && is_array($GLOBALS['plugins'])) { |
|
0 commit comments