[FEATURE] Add a hook to DataHandler - localize - translateToMessage 20/40920/9
authorGoran Medakovic <avion.bg@gmail.com>
Sat, 4 Jul 2015 08:58:07 +0000 (10:58 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Wed, 7 Dec 2016 12:26:37 +0000 (13:26 +0100)
Passing entire $langRec variable instead of just the title.

Resolves: #67909
Releases: master
Change-Id: Ibb7ccf91ea9ed2958043705b36238df44066e9cd
Reviewed-on: https://review.typo3.org/40920
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: TYPO3com <no-reply@typo3.com>
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/Documentation/Changelog/master/Feature-67909-AddHookToDataHandler-Localize-TranslateToMessage.rst [new file with mode: 0644]

index 5ce12ba..02e312c 100644 (file)
@@ -4622,6 +4622,14 @@ class DataHandler
                     } 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);
+                            if (method_exists($hookObj, 'processTranslateTo_copyAction')) {
+                                $hookObj->processTranslateTo_copyAction($row[$fN], $langRec, $this);
+                            }
+                        }
+                    }
                     $overrideValues[$fN] = '[' . $translateToMsg . '] ' . $row[$fN];
                 }
             } elseif (
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-67909-AddHookToDataHandler-Localize-TranslateToMessage.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-67909-AddHookToDataHandler-Localize-TranslateToMessage.rst
new file mode 100644 (file)
index 0000000..c2a3fa8
--- /dev/null
@@ -0,0 +1,36 @@
+.. include:: ../../Includes.txt
+
+=========================================================================
+Feature: #67909 - Add hook to DataHandler - localize - translateToMessage
+=========================================================================
+
+See :issue:`67909`
+
+Description
+===========
+
+By introducing a new hook to the localize function, translateToMessage processing you are now able to
+use external translation services and speed-up translation of the content and even add a custom
+transliteration function that would handle various content transformations.
+
+
+Impact
+======
+
+A new hook is available at:
+
+.. code-block:: php
+
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processTranslateToClass']
+
+Implement it for example as follows:
+
+.. code-block:: php
+
+       class YourHookClass {
+               public function processTranslateTo_copyAction(&$content, $lang, $dataHandler) {
+                       // Do something with content (translate, transliterate etc)
+               }
+       }
+
+.. index:: PHP-API
\ No newline at end of file