#86683locallangXMLOverride not working due to incorrect language file path
Description
Hi,
i’ve found a problem with using XML/XLF override files.
Setup language override in an extensions ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:news/Resources/Private/Language/locallang.xlf'][] = 'EXT:' . $_EXTKEY . '/Resources/Private/Language/Extensions/News/locallang.xlf'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['de']['EXT:news/Resources/Private/Language/locallang.xlf'][] = 'EXT:' . $_EXTKEY . '/Resources/Private/Language/Extensions/News/de.locallang.xlf';
TYPO3\CMS\Core\Classes\Localization\LocalizationFactory->localizationOverride()
Will be called when a locallangXMLOverride configuration is available. Within this method, for every localization file that is present, a check is performed, if an override exists. This is made by checking if an array key of the language file exists in the locallangXMLOverride array.
foreach ($this->store->getSupportedExtensions() as $extension) {
if (isset($locallangXMLOverride[$languageKey][$fileReferenceWithoutExtension . '.' . $extension]) && is_array($locallangXMLOverride[$languageKey][$fileReferenceWithoutExtension . '.' . $extension])) {
$overrides = array_merge($overrides, $locallangXMLOverride[$languageKey][$fileReferenceWithoutExtension . '.' . $extension]);
} elseif (isset($locallangXMLOverride[$fileReferenceWithoutExtension . '.' . $extension]) && is_array($locallangXMLOverride[$fileReferenceWithoutExtension . '.' . $extension])) {
$overrides = array_merge($overrides, $locallangXMLOverride[$fileReferenceWithoutExtension . '.' . $extension]);
}
}
Problem is, that the locallangXMLOverride-array is configured with keys like EXT:foo/bar/Resources/Private/Lanugage/foobar.xlf, $fileReferenceWithoutExtension however is the full absolute path to the language file like var/www/html/typo3conf/ext/foo/bar/Resources/Private/Lanugage/foobar.xlf.
Therefore override files are not found, and no override is performed.
TYPO3\CMS\Extbase\Classes\Utility\LocalizationUtility->translate()
At line 89 the following code is executed: $languageFilePath = GeneralUtility::getFileAbsFileName($languageFilePath);.
This leads to the problem with absolute paths describe above.
In TYPO3 8.7.19 this problem is not present, as the translate()-Method is very different from V9.
Regards,
Philipp