[BUGFIX] Allow setting translateToMessage to empty 29/54429/3
authorSusanne Moog <susanne.moog@typo3.com>
Tue, 17 Oct 2017 23:06:30 +0000 (01:06 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Wed, 18 Oct 2017 06:23:47 +0000 (08:23 +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
Reviewed-on: https://review.typo3.org/54429
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/ext_localconf.php

index 89ba74b..3a383d0 100644 (file)
@@ -4769,11 +4769,6 @@ class DataHandler implements LoggerAwareInterface
                         $translateToMsg = $this->getLanguageService()->sL($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 $className) {
                             $hookObj = GeneralUtility::makeInstance($className);
@@ -4782,7 +4777,11 @@ class DataHandler implements LoggerAwareInterface
                             }
                         }
                     }
-                    $overrideValues[$fN] = '[' . $translateToMsg . '] ' . $row[$fN];
+                    if (!empty($translateToMsg)) {
+                        $overrideValues[$fN] = '[' . $translateToMsg . '] ' . $row[$fN];
+                    } else {
+                        $overrideValues[$fN] = $row[$fN];
+                    }
                 }
             } elseif (
                 ($fCfg['l10n_mode'] === 'exclude')
index db26067..5596b55 100644 (file)
@@ -131,3 +131,8 @@ unset($extractorRegistry);
         'className' => TYPO3\CMS\Core\Authentication\AuthenticationService::class
     ]
 );
+
+// add default notification options to every page
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
+    'TCEMAIN.translateToMessage = Translate to %s:'
+);