[TASK][FOLLOWUP] Optimize loading of locallang strings in JavaScript 03/38003/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sun, 22 Mar 2015 17:07:36 +0000 (18:07 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 22 Mar 2015 22:01:05 +0000 (23:01 +0100)
Rename the method and check if TYPO3_MODE is FE before converting the strings
to UTF-8.

Resolves: #65899
Releases: master
Change-Id: I139f6ceb24a1243be23ad1aec42385f1db0eb121
Reviewed-on: http://review.typo3.org/38003
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Page/PageRenderer.php

index 6697ff4..af334bd 100644 (file)
@@ -2247,7 +2247,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                        // Remove extjs from JScodeLibArray
                        unset($this->jsFiles[$this->backPath . $this->extJsPath . 'ext-all.js'], $this->jsFiles[$this->backPath . $this->extJsPath . 'ext-all-debug.js']);
                }
-               $this->loadBackendJavaScriptLanguageStrings();
+               $this->loadJavaScriptLanguageStrings();
                if (TYPO3_MODE === 'BE') {
                        $this->addAjaxUrlsToInlineSettings();
                }
@@ -2305,9 +2305,9 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
        }
 
        /**
-        * Load the language strings of the backend module into JavaScript
+        * Load the language strings into JavaScript
         */
-       protected function loadBackendJavaScriptLanguageStrings() {
+       protected function loadJavaScriptLanguageStrings() {
                if (count($this->inlineLanguageLabelFiles)) {
                        foreach ($this->inlineLanguageLabelFiles as $languageLabelFile) {
                                $this->includeLanguageFileForInline($languageLabelFile['fileRef'], $languageLabelFile['selectionPrefix'], $languageLabelFile['stripFromSelectionName'], $languageLabelFile['errorMode']);
@@ -2315,7 +2315,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                }
                $this->inlineLanguageLabelFiles = array();
                // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
-               if ($this->getCharSet() !== 'utf-8') {
+               if (TYPO3_MODE === 'FE' && $this->getCharSet() !== 'utf-8') {
                        if ($this->inlineLanguageLabels) {
                                $this->csConvObj->convArray($this->inlineLanguageLabels, $this->getCharSet(), 'utf-8');
                        }