[FEATURE] Translate Indexed Search Configuration Titles 46/61446/3
authorBenni Mack <benni@typo3.org>
Mon, 5 Aug 2019 15:25:04 +0000 (17:25 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 20 Sep 2019 08:09:35 +0000 (10:09 +0200)
Allows to override index_config titles that are
rendered in the dropdown of the Form in Indexed Search
and as headline when a configuration is selected.

Resolves: #9070
Releases: master
Change-Id: I1b013af529ba4985266535b2955bf4a32bba9ebd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61446
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Daniel Gorges <daniel.gorges@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Daniel Gorges <daniel.gorges@b13.com>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Documentation/Changelog/master/Feature-9070-AllowTranslationOfIndexConfigurationTitles.rst [new file with mode: 0644]
typo3/sysext/indexed_search/Classes/Controller/SearchController.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-9070-AllowTranslationOfIndexConfigurationTitles.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-9070-AllowTranslationOfIndexConfigurationTitles.rst
new file mode 100644 (file)
index 0000000..5910817
--- /dev/null
@@ -0,0 +1,28 @@
+.. include:: ../../Includes.txt
+
+================================================================
+Feature: #9070 - Allow translation of index configuration titles
+================================================================
+
+See :issue:`9070`
+
+Description
+===========
+
+Indexed search plugin allows to select specifically which index configuration to be queried from in the specific form,
+where a dropdown shows all possible indexing configurations.
+
+
+Impact
+======
+
+It is now possible to add a label for each configuration via TypoScript in each language.
+
+.. code-block:: typoscript
+
+   plugin.tx_indexedsearch.settings._LOCAL_LANG {
+      de.indexingConfigurations.13 = Mein Titel in Deutsch für Konfiguration 13
+      de.indexingConfigurationHeader.13 = Alle Ergebnisse für Konfiguration 13
+   }
+
+.. index:: Frontend, ext:indexed_search
index 4edcdce..ae07102 100644 (file)
@@ -292,7 +292,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                         ->getQueryBuilderForTable('index_config');
                     $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
                     $indexCfgRec = $queryBuilder
-                        ->select('*')
+                        ->select('title')
                         ->from('index_config')
                         ->where(
                             $queryBuilder->expr()->eq(
@@ -302,7 +302,8 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                         )
                         ->execute()
                         ->fetch();
-                    $categoryTitle = $indexCfgRec['title'];
+                    $categoryTitle = LocalizationUtility::translate('indexingConfigurationHeader.' . $freeIndexUid, 'IndexedSearch');
+                    $categoryTitle = $categoryTitle ?: $indexCfgRec['title'];
                 } else {
                     $categoryTitle = LocalizationUtility::translate('indexingConfigurationHeader.' . $freeIndexUid, 'IndexedSearch');
                 }
@@ -1206,7 +1207,9 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                     ->execute();
 
                 while ($row = $result->fetch()) {
-                    $allOptions[$row['uid']] = $row['title'];
+                    $indexId = (int)$row['uid'];
+                    $title = LocalizationUtility::translate('indexingConfigurations.' . $indexId, 'IndexedSearch');
+                    $allOptions[$indexId] = $title ?: $row['title'];
                 }
             }
             // disable single entries by TypoScript