[BUGFIX] Allow setting translateToMessage to empty 63/54463/2
authorSusanne Moog <susanne.moog@typo3.com>
Tue, 17 Oct 2017 23:06:30 +0000 (01:06 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Mon, 23 Oct 2017 07:37:19 +0000 (09:37 +0200)
Unsetting TCEMAIN.translateToMessage was not possible
due to a default fallback to a hardcoded string in
data handler.

This patch sets the default via PageTSConfig and
simplifies the condition / fallback logic.

Change-Id: Ie06410126a83de0e158c43cbfd6ee3d45176c363
Resolves: #82523
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/54463
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/ext_localconf.php

index 3c8f246..816f3e1 100644 (file)
@@ -4840,11 +4840,6 @@ class DataHandler
                         $translateToMsg = $GLOBALS['LANG'] ? $GLOBALS['LANG']->sL($TSConfig['translateToMessage']) : $TSConfig['translateToMessage'];
                         $translateToMsg = @sprintf($translateToMsg, $langRec['title']);
                     }
-                    if (empty($translateToMsg)) {
-                        $translateToMsg = 'Translate to ' . $langRec['title'] . ':';
-                    } else {
-                        $translateToMsg = @sprintf($TSConfig['translateToMessage'], $langRec['title']);
-                    }
                     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processTranslateToClass'])) {
                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processTranslateToClass'] as $classRef) {
                             $hookObj = GeneralUtility::getUserObj($classRef);
@@ -4853,7 +4848,11 @@ class DataHandler
                             }
                         }
                     }
-                    $overrideValues[$fN] = '[' . $translateToMsg . '] ' . $row[$fN];
+                    if (!empty($translateToMsg)) {
+                        $overrideValues[$fN] = '[' . $translateToMsg . '] ' . $row[$fN];
+                    } else {
+                        $overrideValues[$fN] = $row[$fN];
+                    }
                 }
             } elseif (
                 ($fCfg['l10n_mode'] === 'exclude')
index bda8eb4..26d5749 100644 (file)
@@ -103,3 +103,8 @@ unset($textExtractorRegistry);
 $extractorRegistry = \TYPO3\CMS\Core\Resource\Index\ExtractorRegistry::getInstance();
 $extractorRegistry->registerExtractionService(\TYPO3\CMS\Core\Resource\OnlineMedia\Metadata\Extractor::class);
 unset($extractorRegistry);
+
+// add default notification options to every page
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
+    'TCEMAIN.translateToMessage = Translate to %s:'
+);