Commit 731c3f38 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Fetch language from Context and not from TypoScript configuration

parent 85558739
......@@ -29,6 +29,8 @@ namespace SGalinski\SgMail\Finisher\Forms;
use SGalinski\SgMail\Service\MailTemplateService;
use SGalinski\SgMail\Service\RegisterService;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
......@@ -119,7 +121,10 @@ class FormsFinisher extends AbstractFinisher {
}
$mailTemplateService->setIgnoreMailQueue(TRUE);
$mailTemplateService->setLanguage($GLOBALS['TSFE']->config['config']['language']);
$languageId = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('language', 'id', 0);
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId((int) $GLOBALS['TSFE']->id);
$siteLanguage = $site->getLanguageById($languageId);
$mailTemplateService->setLanguage($siteLanguage->getTypo3Language());
$mailToAddresses = trim((string) $this->parseOption('mailTo'));
if ($mailToAddresses !== '') {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment