[TASK] Deprecate GeneralUtility:readLLfile 97/41197/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 14 Jul 2015 13:20:12 +0000 (15:20 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 14 Jul 2015 20:05:30 +0000 (22:05 +0200)
readLLfile() was just a wrapper around LocalizationFactory.
This is resolved now by adapting all calls and moving a left
over code snippet to the factory method.

Resolves: #68122
Releases: master
Change-Id: Ib416e380f25b06a055b7f25103e19925b29d7fde
Reviewed-on: http://review.typo3.org/41197
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
13 files changed:
typo3/sysext/core/Classes/Localization/LocalizationFactory.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-68122-GeneralUtilityReadLLfile.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/LocalizationFactoryTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/LocallangXmlParserTest.php
typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php
typo3/sysext/lang/Classes/LanguageService.php
typo3/sysext/rtehtmlarea/Classes/Form/Element/RichTextElement.php

index 8f1a539..c8ed495 100644 (file)
@@ -77,7 +77,25 @@ class LocalizationFactory implements \TYPO3\CMS\Core\SingletonInterface {
         * @param bool $isLocalizationOverride TRUE if $fileReference is a localization override
         * @return array|boolean
         */
-       public function getParsedData($fileReference, $languageKey, $charset, $errorMode, $isLocalizationOverride = FALSE) {
+       public function getParsedData($fileReference, $languageKey, $charset = '', $errorMode = 0, $isLocalizationOverride = FALSE) {
+               // @deprecated since CMS 7, will be removed with CMS 8
+               // this is a fallback to convert references to old 'cms' locallang files to the new location
+               if (strpos($fileReference, 'EXT:cms') === 0) {
+                       $mapping = [
+                               'cms/web_info/loallang.xlf' => 'frontend/Resources/Private/Language/locallang_webinfo.xlf',
+                               'cms/locallang_ttc.xlf' => 'frontend/Resources/Private/Language/locallang_ttc.xlf',
+                               'cms/locallang_tca.xlf' => 'frontend/Resources/Private/Language/locallang_tca.xlf',
+                               'cms/layout/locallang_db_new_content_el.xlf' => 'backend/Resources/Private/Language/locallang_db_new_content_el.xlf',
+                               'cms/layout/locallang.xlf' => 'backend/Resources/Private/Language/locallang_layout.xlf',
+                               'cms/layout/locallang_mod.xlf' => 'backend/Resources/Private/Language/locallang_mod.xlf',
+                               'cms/locallang_csh_webinfo.xlf' => 'frontend/Resources/Private/Language/locallang_csh_webinfo.xlf',
+                               'cms/locallang_csh_weblayout.xlf' => 'frontend/Resources/Private/Language/locallang_csh_weblayout.xlf',
+                       ];
+                       $filePath = substr($fileReference, 4);
+                       GeneralUtility::deprecationLog('There is a reference to "' . $fileReference . '", which has been moved to "EXT:' . $mapping[$filePath] . '". This fallback will be removed with CMS 8.');
+                       $fileReference = 'EXT:' . $mapping[$filePath];
+               }
+
                try {
                        $hash = md5($fileReference . $languageKey . $charset);
                        $this->errorMode = $errorMode;
index 86698ec..5d22a1a 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Page;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -2507,6 +2508,9 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
         * @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.
         */
        protected function readLLfile($fileRef, $errorMode = 0) {
+               /** @var $languageFactory LocalizationFactory */
+               $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
+
                if ($this->lang !== 'default') {
                        $languages = array_reverse($this->languageDependencies);
                        // At least we need to have English
@@ -2519,7 +2523,8 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
 
                $localLanguage = array();
                foreach ($languages as $language) {
-                       $tempLL = GeneralUtility::readLLfile($fileRef, $language, $this->charSet, $errorMode);
+                       $tempLL = $languageFactory->getParsedData($fileRef, $language, $this->charSet, $errorMode);
+
                        $localLanguage['default'] = $tempLL['default'];
                        if (!isset($localLanguage[$this->lang])) {
                                $localLanguage[$this->lang] = $localLanguage['default'];
index c6ab261..64d357c 100755 (executable)
@@ -3983,26 +3983,10 @@ Connection: close
         * @param string $charset Character set (option); if not set, determined by the language key
         * @param int $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception
         * @return array Value of $LOCAL_LANG found in the included file. If that array is found it will returned.
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        static public function readLLfile($fileRef, $langKey, $charset = '', $errorMode = 0) {
-               // @deprecated since CMS 7, will be removed with CMS 8
-               // this is a fallback to convert references to old 'cms' locallang files to the new location
-               if (strpos($fileRef, 'EXT:cms') === 0) {
-                       $mapping = [
-                               'cms/web_info/loallang.xlf' => 'frontend/Resources/Private/Language/locallang_webinfo.xlf',
-                               'cms/locallang_ttc.xlf' => 'frontend/Resources/Private/Language/locallang_ttc.xlf',
-                               'cms/locallang_tca.xlf' => 'frontend/Resources/Private/Language/locallang_tca.xlf',
-                               'cms/layout/locallang_db_new_content_el.xlf' => 'backend/Resources/Private/Language/locallang_db_new_content_el.xlf',
-                               'cms/layout/locallang.xlf' => 'backend/Resources/Private/Language/locallang_layout.xlf',
-                               'cms/layout/locallang_mod.xlf' => 'backend/Resources/Private/Language/locallang_mod.xlf',
-                               'cms/locallang_csh_webinfo.xlf' => 'frontend/Resources/Private/Language/locallang_csh_webinfo.xlf',
-                               'cms/locallang_csh_weblayout.xlf' => 'frontend/Resources/Private/Language/locallang_csh_weblayout.xlf',
-                       ];
-                       $filePath = substr($fileRef, 4);
-                       self::deprecationLog('There is a reference to "' . $fileRef . '", which has been moved to "EXT:' . $mapping[$filePath] . '". This fallback will be removed with CMS 8.');
-                       $fileRef = 'EXT:' . $mapping[$filePath];
-               }
-
+               self::logDeprecatedFunction();
                /** @var $languageFactory \TYPO3\CMS\Core\Localization\LocalizationFactory */
                $languageFactory = self::makeInstance(\TYPO3\CMS\Core\Localization\LocalizationFactory::class);
                return $languageFactory->getParsedData($fileRef, $langKey, $charset, $errorMode);
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-68122-GeneralUtilityReadLLfile.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-68122-GeneralUtilityReadLLfile.rst
new file mode 100644 (file)
index 0000000..6eb5178
--- /dev/null
@@ -0,0 +1,34 @@
+==========================================================
+Deprecation: #68122 - Deprecate GeneralUtility::readLLfile
+==========================================================
+
+Description
+===========
+
+Method ``GeneralUtility::realLLfile()`` was just a wrapper around LocalizationFactory
+and has been deprecated.
+
+
+Impact
+======
+
+Extensions using ``realLLfile()`` to parse localization files should switch to
+an instance of ``LocalizationFactory``.
+
+
+Affected Installations
+======================
+
+Extensions using ``GeneralUtility::readLLfile()``
+
+
+Migration
+=========
+
+A typical call now should look like:
+
+.. code-block:: php
+
+               /** @var $languageFactory \TYPO3\CMS\Core\Localization\LocalizationFactory */
+               $languageFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LocalizationFactory::class);
+               $languageFactory->getParsedData($fileToParse, $language, $renderCharset, $errorMode);
diff --git a/typo3/sysext/core/Tests/Unit/Localization/LocalizationFactoryTest.php b/typo3/sysext/core/Tests/Unit/Localization/LocalizationFactoryTest.php
new file mode 100644 (file)
index 0000000..b688542
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Localization;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+/**
+ * Test case
+ *
+ * @author Xavier Perseguers <xavier@typo3.org>
+ */
+class LocalizationFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
+
+       /**
+        * @test
+        */
+       public function getParsedDataHandlesLocallangXMLOverride() {
+               /** @var $subject LocalizationFactory */
+               $subject = new LocalizationFactory;
+
+               $unique = 'locallangXMLOverrideTest' . substr($this->getUniqueId(), 0, 10);
+               $xml = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+                       <T3locallang>
+                               <data type="array">
+                                       <languageKey index="default" type="array">
+                                               <label index="buttons.logout">EXIT</label>
+                                       </languageKey>
+                               </data>
+                       </T3locallang>';
+               $file = PATH_site . 'typo3temp/' . $unique . '.xml';
+               GeneralUtility::writeFileToTypo3tempDir($file, $xml);
+               // Make sure there is no cached version of the label
+               GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('l10n')->flush();
+               // Get default value
+               $defaultLL = $subject->getParsedData('EXT:lang/locallang_core.xlf', 'default');
+               // Clear language cache again
+               GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('l10n')->flush();
+               // Set override file
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:lang/locallang_core.xlf'][$unique] = $file;
+               /** @var $store \TYPO3\CMS\Core\Localization\LanguageStore */
+               $store = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageStore::class);
+               $store->flushData('EXT:lang/locallang_core.xlf');
+               // Get override value
+               $overrideLL = $subject->getParsedData('EXT:lang/locallang_core.xlf', 'default');
+               // Clean up again
+               unlink($file);
+               $this->assertNotEquals($overrideLL['default']['buttons.logout'][0]['target'], '');
+               $this->assertNotEquals($defaultLL['default']['buttons.logout'][0]['target'], $overrideLL['default']['buttons.logout'][0]['target']);
+               $this->assertEquals($overrideLL['default']['buttons.logout'][0]['target'], 'EXIT');
+       }
+
+}
index 62bb204..145f22d 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Localization\Parser;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 
 /**
  * Testcase for class \TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser.
@@ -118,8 +119,14 @@ class LocallangXmlParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function canOverrideLlxml() {
+               /** @var $factory LocalizationFactory */
+               $factory = new LocalizationFactory;
+
                $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][self::getFixtureFilePath('locallang.xml')][] = self::getFixtureFilePath('locallang_override.xml');
-               $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallang.xml'), 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallang.xml'), 'md5'));
+               $LOCAL_LANG = array_merge(
+                       $factory->getParsedData(self::getFixtureFilePath('locallang.xml'), 'default'),
+                       $factory->getParsedData(self::getFixtureFilePath('locallang.xml'), 'md5')
+               );
                $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
                $this->assertArrayHasKey('md5', $LOCAL_LANG, 'md5 key not found in $LOCAL_LANG');
                $expectedLabels = array(
@@ -142,7 +149,10 @@ class LocallangXmlParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        }
 
        public function numericKeysDataProvider() {
-               $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallangNumericKeys.xml'), 'default');
+               /** @var $factory LocalizationFactory */
+               $factory = new LocalizationFactory;
+
+               $LOCAL_LANG = $factory->getParsedData(self::getFixtureFilePath('locallangNumericKeys.xml'), 'default');
                $translations = array();
 
                foreach ($LOCAL_LANG['default'] as $key => $labelData) {
@@ -157,7 +167,10 @@ class LocallangXmlParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @dataProvider numericKeysDataProvider
         */
        public function canTranslateNumericKeys($key, $expectedResult) {
-               $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallangNumericKeys.xml'), 'fr');
+               /** @var $factory LocalizationFactory */
+               $factory = new LocalizationFactory;
+
+               $LOCAL_LANG = $factory->getParsedData(self::getFixtureFilePath('locallangNumericKeys.xml'), 'fr');
 
                $this->assertEquals($expectedResult, $LOCAL_LANG['fr'][$key][0]['target']);
        }
index 62b0da8..af3e396 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Localization\Parser;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 
 /**
  * Testcase for class \TYPO3\CMS\Core\Localization\Parser\XliffParser.
@@ -110,9 +111,15 @@ class XliffParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function canOverrideXliff() {
+               /** @var $factory LocalizationFactory */
+               $factory = new LocalizationFactory;
+
                $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override'];
                $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr'];
-               $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'fr'));
+               $LOCAL_LANG = array_merge(
+                       $factory->getParsedData($this->xliffFileNames['locallang'], 'default'),
+                       $factory->getParsedData($this->xliffFileNames['locallang'], 'fr')
+               );
                $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
                $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
                $expectedLabels = array(
@@ -141,8 +148,11 @@ class XliffParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function canOverrideXliffWithFrenchOnly() {
+               /** @var $factory LocalizationFactory */
+               $factory = new LocalizationFactory;
+
                $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr'];
-               $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'fr');
+               $LOCAL_LANG = $factory->getParsedData($this->xliffFileNames['locallang'], 'fr');
                $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
                $expectedLabels = array(
                        'label1' => 'Ceci est mon 1er libellĂ©',
index 3198066..5819780 100644 (file)
@@ -2369,44 +2369,6 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->assertSame('\'' . $expected . '\'', GeneralUtility::quoteJSvalue($input));
        }
 
-       //////////////////////////////////
-       // Tests concerning readLLfile
-       //////////////////////////////////
-       /**
-        * @test
-        */
-       public function readLLfileHandlesLocallangXMLOverride() {
-               $unique = 'locallangXMLOverrideTest' . substr($this->getUniqueId(), 0, 10);
-               $xml = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-                       <T3locallang>
-                               <data type="array">
-                                       <languageKey index="default" type="array">
-                                               <label index="buttons.logout">EXIT</label>
-                                       </languageKey>
-                               </data>
-                       </T3locallang>';
-               $file = PATH_site . 'typo3temp/' . $unique . '.xml';
-               GeneralUtility::writeFileToTypo3tempDir($file, $xml);
-               // Make sure there is no cached version of the label
-               GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('l10n')->flush();
-               // Get default value
-               $defaultLL = GeneralUtility::readLLfile('EXT:lang/locallang_core.xlf', 'default');
-               // Clear language cache again
-               GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('l10n')->flush();
-               // Set override file
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:lang/locallang_core.xlf'][$unique] = $file;
-               /** @var $store \TYPO3\CMS\Core\Localization\LanguageStore */
-               $store = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageStore::class);
-               $store->flushData('EXT:lang/locallang_core.xlf');
-               // Get override value
-               $overrideLL = GeneralUtility::readLLfile('EXT:lang/locallang_core.xlf', 'default');
-               // Clean up again
-               unlink($file);
-               $this->assertNotEquals($overrideLL['default']['buttons.logout'][0]['target'], '');
-               $this->assertNotEquals($defaultLL['default']['buttons.logout'][0]['target'], $overrideLL['default']['buttons.logout'][0]['target']);
-               $this->assertEquals($overrideLL['default']['buttons.logout'][0]['target'], 'EXIT');
-       }
-
        ///////////////////////////////
        // Tests concerning _GETset()
        ///////////////////////////////
index faf77e5..e5b77b3 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Extbase\Utility;
  */
 
 use TYPO3\CMS\Core\Localization\Locales;
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
@@ -163,9 +164,13 @@ class LocalizationUtility {
                $locallangPathAndFilename = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName) . '/' . self::$locallangPath . 'locallang.xlf';
                self::setLanguageKeys();
                $renderCharset = TYPO3_MODE === 'FE' ? self::getTypoScriptFrontendController()->renderCharset : self::getLanguageService()->charSet;
-               self::$LOCAL_LANG[$extensionName] = GeneralUtility::readLLfile($locallangPathAndFilename, self::$languageKey, $renderCharset);
+
+               /** @var $languageFactory LocalizationFactory */
+               $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
+
+               self::$LOCAL_LANG[$extensionName] = $languageFactory->getParsedData($locallangPathAndFilename, self::$languageKey, $renderCharset);
                foreach (self::$alternativeLanguageKeys as $language) {
-                       $tempLL = GeneralUtility::readLLfile($locallangPathAndFilename, $language, $renderCharset);
+                       $tempLL = $languageFactory->getParsedData($locallangPathAndFilename, $language, $renderCharset);
                        if (self::$languageKey !== 'default' && isset($tempLL[$language])) {
                                self::$LOCAL_LANG[$extensionName][$language] = $tempLL[$language];
                        }
index 3b62109..f7ca37b 100644 (file)
@@ -21,6 +21,7 @@ use TYPO3\CMS\Core\Charset\CharsetConverter;
 use TYPO3\CMS\Core\Error\Http\PageNotFoundException;
 use TYPO3\CMS\Core\Error\Http\ServiceUnavailableException;
 use TYPO3\CMS\Core\Localization\Locales;
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Locking\Exception\LockAcquireWouldBlockException;
 use TYPO3\CMS\Core\Locking\Locker;
 use TYPO3\CMS\Core\Messaging\ErrorpageMessage;
@@ -4406,6 +4407,9 @@ class TypoScriptFrontendController {
         * @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.
         */
        public function readLLfile($fileRef) {
+               /** @var $languageFactory LocalizationFactory */
+               $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
+
                if ($this->lang !== 'default') {
                        $languages = array_reverse($this->languageDependencies);
                        // At least we need to have English
@@ -4418,7 +4422,7 @@ class TypoScriptFrontendController {
 
                $localLanguage = array();
                foreach ($languages as $language) {
-                       $tempLL = GeneralUtility::readLLfile($fileRef, $language, $this->renderCharset);
+                       $tempLL = $languageFactory->getParsedData($fileRef, $language, $this->renderCharset);
                        $localLanguage['default'] = $tempLL['default'];
                        if (!isset($localLanguage[$this->lang])) {
                                $localLanguage[$this->lang] = $localLanguage['default'];
index 93078d7..8be85ea 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Frontend\Plugin;
  */
 
 use TYPO3\CMS\Core\Localization\Locales;
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
@@ -982,12 +983,15 @@ class AbstractPlugin {
         */
        public function pi_loadLL() {
                if (!$this->LOCAL_LANG_loaded && $this->scriptRelPath) {
+                       /** @var $languageFactory LocalizationFactory */
+                       $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
+
                        $basePath = 'EXT:' . $this->extKey . '/' . dirname($this->scriptRelPath) . '/locallang.xlf';
                        // Read the strings in the required charset (since TYPO3 4.2)
-                       $this->LOCAL_LANG = GeneralUtility::readLLfile($basePath, $this->LLkey, $this->frontendController->renderCharset);
+                       $this->LOCAL_LANG = $languageFactory->getParsedData($basePath, $this->LLkey, $this->frontendController->renderCharset);
                        $alternativeLanguageKeys = GeneralUtility::trimExplode(',', $this->altLLkey, TRUE);
                        foreach ($alternativeLanguageKeys as $languageKey) {
-                               $tempLL = GeneralUtility::readLLfile($basePath, $languageKey);
+                               $tempLL = $languageFactory->getParsedData($basePath, $languageKey);
                                if ($this->LLkey !== 'default' && isset($tempLL[$languageKey])) {
                                        $this->LOCAL_LANG[$languageKey] = $tempLL[$languageKey];
                                }
index 7a22abd..2941e30 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Lang;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -97,7 +98,7 @@ class LanguageService {
        /**
         * instance of the parser factory
         *
-        * @var \TYPO3\CMS\Core\Localization\LocalizationFactory
+        * @var LocalizationFactory
         */
        public $parserFactory;
 
@@ -124,7 +125,7 @@ class LanguageService {
                $this->csConvObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Charset\CharsetConverter::class);
                $this->charSetArray = $this->csConvObj->charSetArray;
                // Initialize the parser factory object
-               $this->parserFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LocalizationFactory::class);
+               $this->parserFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
                // Find the requested language in this list based
                // on the $lang key being inputted to this function.
                /** @var $locales \TYPO3\CMS\Core\Localization\Locales */
@@ -146,7 +147,7 @@ class LanguageService {
        /**
         * Gets the parser factory.
         *
-        * @return \TYPO3\CMS\Core\Localization\LocalizationFactory
+        * @return LocalizationFactory
         */
        public function getParserFactory() {
                return $this->parserFactory;
@@ -413,7 +414,7 @@ class LanguageService {
                }
                $localLanguage = array();
                foreach ($languages as $language) {
-                       $tempLL = GeneralUtility::readLLfile($fileRef, $language, $this->charSet);
+                       $tempLL = $this->parserFactory->getParsedData($fileRef, $language, $this->charSet);
                        $localLanguage['default'] = $tempLL['default'];
                        if (!isset($localLanguage[$this->lang])) {
                                $localLanguage[$this->lang] = $localLanguage['default'];
index 46ed9a9..5b54257 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Rtehtmlarea\Form\Element;
 
 use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\FrontendEditing\FrontendEditingController;
@@ -1042,7 +1043,9 @@ class RichTextElement extends AbstractFormElement {
         * @return array Label keys and values
         */
        protected function getMergedLabelsFromFile($fileName) {
-               $localizationArray = GeneralUtility::readLLfile($fileName, $this->language, 'utf-8', 1);
+               /** @var $languageFactory LocalizationFactory */
+               $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
+               $localizationArray = $languageFactory->getParsedData($fileName, $this->language, 'utf-8', 1);
                if (is_array($localizationArray) && !empty($localizationArray)) {
                        if (!empty($localizationArray[$this->language])) {
                                $finalLocalLang = $localizationArray['default'];