From 17eb89945ca13821d03a0ef6a657df62911a4829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Fri, 22 Dec 2023 10:53:48 +0100 Subject: [PATCH] Fix powermailValidator error translation --- Classes/FieldValidator/PowermailValidator.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Classes/FieldValidator/PowermailValidator.php b/Classes/FieldValidator/PowermailValidator.php index 8e9e0ee..034af42 100644 --- a/Classes/FieldValidator/PowermailValidator.php +++ b/Classes/FieldValidator/PowermailValidator.php @@ -6,7 +6,6 @@ use In2code\Powermail\Domain\Validator\AbstractValidator; use StudioMitte\FriendlyCaptcha\Service\Api; -use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Error\Error; use TYPO3\CMS\Extbase\Error\Result; @@ -23,12 +22,11 @@ public function validate($mail): Result if (!$this->isFormWithCaptchaField($mail) || $this->isCaptchaCheckToSkip()) { return $result; } - $friendlyCaptchaService = GeneralUtility::makeInstance(Api::class); if (!$friendlyCaptchaService->verify()) { $result->addError( new Error( - $this->getLanguageService()->sL('LLL:EXT:friendlycaptcha_official/Resources/Private/Language/locallang.xlf:message.invalid'), + $this->translateErrorMessage('message.invalid', 'friendlycaptcha_official'), 1689157219 ) ); @@ -36,11 +34,6 @@ public function validate($mail): Result return $result; } - public function isValid(mixed $mail): void - { - return; - } - protected function isFormWithCaptchaField($mail): bool { foreach ($mail->getForm()->getPages() as $page) { @@ -75,9 +68,4 @@ protected function getActionName(): string $pluginVariables = GeneralUtility::_GPmerged('tx_powermail_pi1'); return $pluginVariables['action']; } - - private function getLanguageService(): LanguageService - { - return $GLOBALS['LANG']; - } }