Issue Bug Closed

#106303Image description of sys_file_reference is not translated in frontend

Fabian Gassen 03/04/25, 14:50 updated 12/02/25, 14:22

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