[FEATURE] Add "LLL:" support in PAGE.inlineLanguageLabel 05/29605/9
authorClément MICHELET <clement.michelet@smile.fr>
Tue, 22 Apr 2014 12:47:45 +0000 (14:47 +0200)
committerFrank Nägler <typo3@naegler.net>
Sat, 4 Apr 2015 19:41:55 +0000 (21:41 +0200)
You can add either a constant or a locallang reference using
page.inlineLanguageLabel.[key]

Resolves: #57237
Releases: master
Change-Id: I519e0c70908752ec69cb015ed7785995fb2bf5e8
Reviewed-on: http://review.typo3.org/29605
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Göran Bodenschatz <coding@46halbe.de>
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/frontend/Classes/Page/PageGenerator.php

index 69087d0..692b5bb 100644 (file)
@@ -1790,9 +1790,16 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
         * Need extJs loaded
         *
         * @param array $array
         * Need extJs loaded
         *
         * @param array $array
+        * @param bool $parseWithLanguageService
         * @return void
         */
         * @return void
         */
-       public function addInlineLanguageLabelArray(array $array) {
+       public function addInlineLanguageLabelArray(array $array, $parseWithLanguageService = FALSE) {
+               if ($parseWithLanguageService === TRUE) {
+                       foreach ($array as $key => $value) {
+                               $array[$key] = $this->getLanguageService()->sL($value);
+                       }
+               }
+
                $this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $array);
        }
 
                $this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $array);
        }
 
@@ -2770,6 +2777,15 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                return $filename;
        }
 
                return $filename;
        }
 
+       /**
+        * Returns global language service instance
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
        /*****************************************************/
        /*                                                   */
        /*  Hooks                                            */
        /*****************************************************/
        /*                                                   */
        /*  Hooks                                            */
index 92c774b..82e9b12 100644 (file)
@@ -943,7 +943,7 @@ class PageGenerator {
                }
                // ExtJS specific code
                if (is_array($tsfe->pSetup['inlineLanguageLabel.'])) {
                }
                // ExtJS specific code
                if (is_array($tsfe->pSetup['inlineLanguageLabel.'])) {
-                       $pageRenderer->addInlineLanguageLabelArray($tsfe->pSetup['inlineLanguageLabel.']);
+                       $pageRenderer->addInlineLanguageLabelArray($tsfe->pSetup['inlineLanguageLabel.'], TRUE);
                }
                if (is_array($tsfe->pSetup['inlineSettings.'])) {
                        $pageRenderer->addInlineSettingArray('TS', $tsfe->pSetup['inlineSettings.']);
                }
                if (is_array($tsfe->pSetup['inlineSettings.'])) {
                        $pageRenderer->addInlineSettingArray('TS', $tsfe->pSetup['inlineSettings.']);