Skip to content
Snippets Groups Projects
Commit 3113ce51 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Switching to sys lang, wip

parent 96bbac37
No related branches found
No related tags found
1 merge request!3New version 4 1
...@@ -155,9 +155,10 @@ class MailController extends ActionController { ...@@ -155,9 +155,10 @@ class MailController extends ActionController {
$this->view->assign('templates', MailTemplateService::getRegisterArray()); $this->view->assign('templates', MailTemplateService::getRegisterArray());
$templateDescription = $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']]['description']; $templateDescription = $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']]['description'];
if (is_array($templateDescription)) { if (is_array($templateDescription)) {
if ($languages[0]) { if ($languages[0]['isocode']) {
$templateDescription = $templateDescription[$languages[0]]; $templateDescription = $templateDescription[$languages[0]['isocode']];
} }
} else { } else {
$templateDescription = LocalizationUtility::translate( $templateDescription = LocalizationUtility::translate(
......
...@@ -37,6 +37,7 @@ use TYPO3\CMS\Core\Imaging\IconFactory; ...@@ -37,6 +37,7 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Request; use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Lang\Domain\Repository\LanguageRepository; use TYPO3\CMS\Lang\Domain\Repository\LanguageRepository;
...@@ -143,14 +144,20 @@ class BackendService { ...@@ -143,14 +144,20 @@ class BackendService {
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public static function getLanguages() { public static function getLanguages() {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); /** @var $databaseConnection DatabaseConnection */
/** @var LanguageRepository $languageRepository */ $databaseConnection = $GLOBALS['TYPO3_DB'];
$languageRepository = $objectManager->get(LanguageRepository::class); /** @var QueryResultInterface $rows */
$activatedLanguages = $languageRepository->findSelected(); $rows = $databaseConnection->exec_SELECTgetRows(
'*',
'sys_language',
'hidden = 0'
);
$languages = ['en']; $languages = [];
foreach ($activatedLanguages as $language) {
$languages[] = $language->getLocale(); foreach ($rows as $language) {
$languages[] = ['isocode' => $language['language_isocode'],
'name' => $language['title']];
} }
return $languages; return $languages;
...@@ -240,8 +247,8 @@ class BackendService { ...@@ -240,8 +247,8 @@ class BackendService {
$templateRepository = $objectManager->get(TemplateRepository::class); $templateRepository = $objectManager->get(TemplateRepository::class);
foreach ($languages as $language) { foreach ($languages as $language) {
$selectedTemplates[$language] = $templateRepository->findOneByTemplate( $selectedTemplates[$language['isocode']] = $templateRepository->findOneByTemplate(
$selectedExtension, $selectedTemplate, $language, $pid $selectedExtension, $selectedTemplate, $language['isocode'], $pid
); );
} }
...@@ -255,7 +262,9 @@ class BackendService { ...@@ -255,7 +262,9 @@ class BackendService {
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public static function getLanguagesForFilter() { public static function getLanguagesForFilter() {
// @TODO
$languages = self::getLanguages(); $languages = self::getLanguages();
array_unshift($languages, ''); array_unshift($languages, '');
$filterLanguages = []; $filterLanguages = [];
foreach ($languages as $key => $value) { foreach ($languages as $key => $value) {
......
...@@ -716,23 +716,4 @@ class MailTemplateService { ...@@ -716,23 +716,4 @@ class MailTemplateService {
$this->pid = (int) $pid; $this->pid = (int) $pid;
return $this; return $this;
} }
/**
* Get all the active system languages in an array
*
* @return array
* @throws \InvalidArgumentException
*/
public static function getSystemLanguages() {
/** @var $databaseConnection DatabaseConnection */
$databaseConnection = $GLOBALS['TYPO3_DB'];
/** @var QueryResultInterface $rows */
$rows = $databaseConnection->exec_SELECTgetRows(
'*',
'sys_language',
'deleted = 0 AND hidden = 1'
);
return $rows->toArray();
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment