diff --git a/typo3/sysext/core/Classes/Localization/LocalizationFactory.php b/typo3/sysext/core/Classes/Localization/LocalizationFactory.php index 03b908f6183ff90e0a894f06244d4c533f2ba630..07ca8afc34c766865b75e0cf21d6bdc15dca5bc5 100644 --- a/typo3/sysext/core/Classes/Localization/LocalizationFactory.php +++ b/typo3/sysext/core/Classes/Localization/LocalizationFactory.php @@ -42,16 +42,6 @@ class LocalizationFactory implements \TYPO3\CMS\Core\SingletonInterface * Class constructor */ public function __construct() - { - $this->initialize(); - } - - /** - * Initialize - * - * @return void - */ - protected function initialize() { $this->store = GeneralUtility::makeInstance(LanguageStore::class); $this->initializeCache(); @@ -142,7 +132,7 @@ class LocalizationFactory implements \TYPO3\CMS\Core\SingletonInterface /** @var $parser \TYPO3\CMS\Core\Localization\Parser\LocalizationParserInterface */ $parser = $this->store->getParserInstance($fileReference); // Get parsed data - $LOCAL_LANG = $parser->getParsedData($this->store->getAbsoluteFileReference($fileReference), $languageKey, $charset); + $LOCAL_LANG = $parser->getParsedData($this->store->getAbsoluteFileReference($fileReference), $languageKey); } catch (Exception\FileNotFoundException $exception) { // Source localization file not found, set empty data as there could be an override $this->store->setData($fileReference, $languageKey, []); diff --git a/typo3/sysext/core/Classes/Localization/Parser/AbstractXmlParser.php b/typo3/sysext/core/Classes/Localization/Parser/AbstractXmlParser.php index dffc270e0e639887a82996423784f2ff84b41aa7..4dba8e2c358ad95f9606bf5b33addf1029555660 100644 --- a/typo3/sysext/core/Classes/Localization/Parser/AbstractXmlParser.php +++ b/typo3/sysext/core/Classes/Localization/Parser/AbstractXmlParser.php @@ -14,7 +14,6 @@ namespace TYPO3\CMS\Core\Localization\Parser; * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Core\Charset\CharsetConverter; use TYPO3\CMS\Core\Localization\Exception\FileNotFoundException; use TYPO3\CMS\Core\Localization\Exception\InvalidXmlFileException; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -34,17 +33,12 @@ abstract class AbstractXmlParser implements LocalizationParserInterface */ protected $languageKey; - /** - * @var string - */ - protected $charset; - /** * Returns parsed representation of XML file. * * @param string $sourcePath Source file path * @param string $languageKey Language key - * @param string $charset File charset + * @param string $charset File charset, not in use anymore and deprecated since TYPO3 v8, will be removed in TYPO3 v9 as UTF-8 is expected for all language files * @return array * @throws \TYPO3\CMS\Core\Localization\Exception\FileNotFoundException */ @@ -52,7 +46,6 @@ abstract class AbstractXmlParser implements LocalizationParserInterface { $this->sourcePath = $sourcePath; $this->languageKey = $languageKey; - $this->charset = $this->getCharset($charset); if ($this->languageKey !== 'default') { $this->sourcePath = GeneralUtility::getFileAbsFileName(GeneralUtility::llXmlAutoFileName($this->sourcePath, $this->languageKey)); if (!@is_file($this->sourcePath)) { @@ -68,21 +61,6 @@ abstract class AbstractXmlParser implements LocalizationParserInterface return $LOCAL_LANG; } - /** - * Gets the character set to use. - * - * @param string $charset - * @return string - */ - protected function getCharset($charset = '') - { - if ($charset !== '') { - return GeneralUtility::makeInstance(CharsetConverter::class)->parse_charset($charset); - } else { - return 'utf-8'; - } - } - /** * Loads the current XML file before processing. * diff --git a/typo3/sysext/core/Classes/Localization/Parser/LocalizationParserInterface.php b/typo3/sysext/core/Classes/Localization/Parser/LocalizationParserInterface.php index 42abfe71fdd29069437fc44d0f4d8b69a3ed643c..91bc3ded70163fef5f8496727922588c6b102575 100644 --- a/typo3/sysext/core/Classes/Localization/Parser/LocalizationParserInterface.php +++ b/typo3/sysext/core/Classes/Localization/Parser/LocalizationParserInterface.php @@ -24,7 +24,7 @@ interface LocalizationParserInterface * * @param string $sourcePath Source file path * @param string $languageKey Language key - * @param string $charset Charset + * @param string $charset Charset, not in use anymore since TYPO3 v8, will be removed in TYPO3 v9 as UTF-8 is expected for all language files * @return array */ public function getParsedData($sourcePath, $languageKey, $charset = ''); diff --git a/typo3/sysext/core/Classes/Localization/Parser/LocallangXmlParser.php b/typo3/sysext/core/Classes/Localization/Parser/LocallangXmlParser.php index 71971ddc7977b9e3ccdf04df31207a1432eb779b..ff3a6780012ea8718cbd3859ab1af43d5cc8f3a1 100644 --- a/typo3/sysext/core/Classes/Localization/Parser/LocallangXmlParser.php +++ b/typo3/sysext/core/Classes/Localization/Parser/LocallangXmlParser.php @@ -36,14 +36,13 @@ class LocallangXmlParser extends AbstractXmlParser * * @param string $sourcePath Source file path * @param string $languageKey Language key - * @param string $charset Charset + * @param string $charset File charset, not in use anymore and deprecated since TYPO3 v8, will be removed in TYPO3 v9 as UTF-8 is expected for all language files * @return array */ public function getParsedData($sourcePath, $languageKey, $charset = '') { $this->sourcePath = $sourcePath; $this->languageKey = $languageKey; - $this->charset = $this->getCharset($charset); // Parse source $parsedSource = $this->parseXmlFile(); // Parse target diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80486-SettingCharsetViaLocalizationParserInterface-getParsedData.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80486-SettingCharsetViaLocalizationParserInterface-getParsedData.rst new file mode 100644 index 0000000000000000000000000000000000000000..d63b4db840e9be4efdcfde9cffed4bd1f7c0ed17 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80486-SettingCharsetViaLocalizationParserInterface-getParsedData.rst @@ -0,0 +1,30 @@ +.. include:: ../../Includes.txt + +====================================================================================== +Deprecation: #80486 - Setting charset via LocalizationParserInterface->getParsedData() +====================================================================================== + +See :issue:`80486` + +Description +=========== + +The `LocalizationParserInterface->getParsedData()` contains a third parameter to hand over a value +for the charset used. + +This third parameter has been marked as deprecated, as it is not in use anymore. + + +Affected Installations +====================== + +Any installation with an extension that extends the LocalizationParser functionality with a custom +PHP class implementing the `LocalizationParserInterface`. + + +Migration +========= + +If implementing the `LocalizationParserInterface`, be aware that this third parameter will be dropped in TYPO3 v9. + +.. index:: PHP-API \ No newline at end of file