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 {
$this->view->assign('templates', MailTemplateService::getRegisterArray());
$templateDescription = $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']]['description'];
if (is_array($templateDescription)) {
if ($languages[0]) {
$templateDescription = $templateDescription[$languages[0]];
if ($languages[0]['isocode']) {
$templateDescription = $templateDescription[$languages[0]['isocode']];
}
} else {
$templateDescription = LocalizationUtility::translate(
......
......@@ -37,6 +37,7 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Lang\Domain\Repository\LanguageRepository;
......@@ -143,14 +144,20 @@ class BackendService {
* @throws \InvalidArgumentException
*/
public static function getLanguages() {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var LanguageRepository $languageRepository */
$languageRepository = $objectManager->get(LanguageRepository::class);
$activatedLanguages = $languageRepository->findSelected();
/** @var $databaseConnection DatabaseConnection */
$databaseConnection = $GLOBALS['TYPO3_DB'];
/** @var QueryResultInterface $rows */
$rows = $databaseConnection->exec_SELECTgetRows(
'*',
'sys_language',
'hidden = 0'
);
$languages = ['en'];
foreach ($activatedLanguages as $language) {
$languages[] = $language->getLocale();
$languages = [];
foreach ($rows as $language) {
$languages[] = ['isocode' => $language['language_isocode'],
'name' => $language['title']];
}
return $languages;
......@@ -240,8 +247,8 @@ class BackendService {
$templateRepository = $objectManager->get(TemplateRepository::class);
foreach ($languages as $language) {
$selectedTemplates[$language] = $templateRepository->findOneByTemplate(
$selectedExtension, $selectedTemplate, $language, $pid
$selectedTemplates[$language['isocode']] = $templateRepository->findOneByTemplate(
$selectedExtension, $selectedTemplate, $language['isocode'], $pid
);
}
......@@ -255,7 +262,9 @@ class BackendService {
* @throws \InvalidArgumentException
*/
public static function getLanguagesForFilter() {
// @TODO
$languages = self::getLanguages();
array_unshift($languages, '');
$filterLanguages = [];
foreach ($languages as $key => $value) {
......
......@@ -716,23 +716,4 @@ class MailTemplateService {
$this->pid = (int) $pid;
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