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

Files 4

History 614

  1. Gerrit Code Review pushed patch set 1 for main to change 88482 status New Under Review 03/04/25, 16:20

  2. Gerrit Code Review pushed patch set 2 for main to change 88482 03/18/25, 10:10

  3. Gerrit Code Review pushed patch set 3 for main to change 88482 03/21/25, 19:24

  4. Gerrit Code Review pushed patch set 4 for main to change 88482 03/21/25, 19:24

  5. Gerrit Code Review pushed patch set 5 for main to change 88482 03/21/25, 19:50

  6. Gerrit Code Review pushed patch set 6 for main to change 88482 03/22/25, 09:28

  7. Gerrit Code Review pushed patch set 7 for main to change 88482 03/26/25, 13:56

  8. Gerrit Code Review pushed patch set 1 for 13.4 to change 88775 03/26/25, 15:28

  9. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % 03/26/25, 15:30

    Applied in changeset commit:c3240dec4e9dd8323ff9300adbd1044becfd4691.

  10. Benni Mack changed Related to #106441 03/26/25, 16:21

  11. Dmytro Doronenko changed Related to #106554 04/11/25, 11:03

  12. Matthias Kappenberg commented 04/16/25, 12:05

    The patch is missing:

    
    $properties += ['uid' => $this->uid, 'pid' => $this->pid];
    
    to
    $properties += ['uid' => $this->uid, 'pid' => $this->pid, '_LOCALIZED_UID' => $this->getComputedProperties()->getLocalizedUid()];

    https://git.typo3.org/typo3/typo3/-/commit/c3240dec4e9dd8323ff9300adbd1044becfd4691#f7616b679d741478a15b8b49a3b2dd6687aeed3f_76_76

    Without the above-mentioned change, it is not working here.

  13. Nikita Hovratov changed Related to #107195 08/15/25, 17:44

  14. Benni Mack changed status Resolved Closed 12/02/25, 14:22