#106303Image description of sys_file_reference is not translated in frontend
Description
1. Prerequisites
I have setup a clean environment to reproduce the issue.
Basic Setup with DDEV
PHP 8.3
TYPO3 13.4.5
Setup at least 2 languages with strict fallback (0 = English, 1 = German).
2. Steps to reproduce
2.1 Add the following Typoscript Configuration
For simplicity I added a PageView in the fluid_styled_content extension.
Typoscript Configuration
page = PAGE
# Working variant
page.100 = CONTENT
page.100 {
table = tt_content
select {
orderBy = sorting
where = {#colPos}=0
}
}
# Not working variant
page.101 = PAGEVIEW
page.101 {
paths {
100 = EXT:fluid_styled_content/Resources/Private/PageView/
}
dataProcessing {
10 = page-content
20 = menu
20.as = mainMenu
}
}
2.2 Add Page template in fluid_styled_content extension
EXT:fluid_styled_content/Resources/Private/PageView/Page/Default.html
<f:debug>{_all}</f:debug>
<f:for each="{content.main.records}" as="contentElement">
<f:cObject
typoscriptObjectPath="{contentElement.mainType}"
table="{contentElement.mainType}"
data="{contentElement}"
/>
</f:for>
2.4 Insert Text & Images
TYPO3_BugBackend.png
Insert a text & images content element in 2 languages. Set the specific image description in all languages in the file reference.
3. Actual Results
The image description is the English image description.
TYPO3_BugComparison.png
4. Expected Results
The image description is the translated (German) description.
5. Additional Notes
The localization works if I do not use the PAGEVIEW Object. see typoscript configuration. And the upper part of the previous screenshot
TYPO3\CMS\Frontend\Resource\FileCollector::getFileReferences()L:291 checks if _LOCALIZED_CONTENT is set on the content element which is not the case (data debug output below).
Therefore, in L:297 the Record is not localized
@if ($isTableLocalizable && $localizedId !== null)@
The RawRecord itself has set the computedProperty localizedUid
TYPO3_BugRecordsDebug.png
The property is lost when toArray is called on the Record, which is what gets fed to the FileProcessor.
TYPO3_BugDataDebug.png
TYPO3\CMS\Core\Domain\RawRecord::toArray() does not use the computedProperties which contains the localizedUid.
If I change the toArray function of RawRecord to the following, the image descriptions get localized correctly.
public function toArray(): array
{
return $this->properties + ['uid' => $this->uid, 'pid' => $this->pid, '_LOCALIZED_UID' => $this->getComputedProperties()->getLocalizedUid()];
}Reviews 8
- 13.4 90846[BUGFIX] Consider already existing _computed in raw record
- main 90539[BUGFIX] Consider already existing _computed in raw record
- 13.4 89168[BUGFIX] Include computed properties in CObject ViewHelper
- main 89157[BUGFIX] Include computed properties in CObject ViewHelper
- 13.4 88777[BUGFIX] Revert interface change in Record API
- main 88776[BUGFIX] Revert interface change in Record API
- main 88482[BUGFIX] Provide _LOCALIZED_UID in RawRecord
- 13.4 88775[BUGFIX] Provide _LOCALIZED_UID in RawRecord