Skip to content

Commit

Permalink
[TASK] Get language from SiteLanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoBlack committed Jun 16, 2021
1 parent bf05fd7 commit 5afba5d
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Classes/Controller/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
use T3G\AgencyPack\Blog\Utility\ArchiveUtility;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Http\NormalizedParams;
use TYPO3\CMS\Core\Pagination\SimplePagination;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Pagination\QueryResultPaginator;
Expand Down Expand Up @@ -136,9 +138,8 @@ protected function initializeView(ViewInterface $view): void
$feedData = [
'title' => LocalizationUtility::translate('feed.title' . $action, 'blog', $arguments),
'description' => LocalizationUtility::translate('feed.description' . $action, 'blog', $arguments),
// @todo use request language instead
'language' => $this->getTypoScriptFontendController()->sys_language_isocode,
'link' => $this->uriBuilder->getRequest()->getRequestUri(),
'language' => $this->getSiteLanguage()->getTwoLetterIsoCode(),
'link' => $this->getRequestUrl(),
'date' => date('r'),
];
$this->view->assign('feed', $feedData);
Expand Down Expand Up @@ -417,4 +418,16 @@ protected function getTypoScriptFontendController(): TypoScriptFrontendControlle
{
return $GLOBALS['TSFE'];
}

private function getSiteLanguage(): ?SiteLanguage
{
return $GLOBALS['TYPO3_REQUEST']->getAttribute('language');
}

private function getRequestUrl(): string
{
/** @var NormalizedParams $normalizedParams */
$normalizedParams = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams');
return $normalizedParams->getRequestUrl();
}
}

0 comments on commit 5afba5d

Please sign in to comment.