Skip to content

Commit

Permalink
[BUGFIX] Use LocalizationUtility instead of LanguageService
Browse files Browse the repository at this point in the history
The LanguageService is only indented for backend usage
and was incorrectly used in frontend context.  The usage in
the comment notification was adapted to now use the
LocalizationUtility.

Fixes: #41
Releases: master, 9.1, 9.0
  • Loading branch information
benjaminkott committed May 14, 2019
1 parent e8e61e9 commit 39b61a4
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Classes/Notification/CommentAddedNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
use T3G\AgencyPack\Blog\Domain\Model\Comment;
use T3G\AgencyPack\Blog\Domain\Model\Post;
use T3G\AgencyPack\Blog\Messaging\MailMessage;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

class CommentAddedNotification extends AbstractNotification
{
Expand All @@ -25,7 +25,7 @@ public function getTitle(): string
{
/** @var Post $post */
$post = $this->data['post'];
return sprintf($this->getLanguageService()->sL('LLL:EXT:blog/Resources/Private/Language/locallang.xlf:emails.CommentAddedNotification.subject'), $post->getTitle());
return sprintf(LocalizationUtility::translate('emails.CommentAddedNotification.subject', 'blog'), $post->getTitle());
}

/**
Expand All @@ -48,12 +48,4 @@ public function getMessage(): string
'post' => $post
]);
}

/**
* @return LanguageService
*/
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}

0 comments on commit 39b61a4

Please sign in to comment.