Project

General

Profile

Actions

Bug #106303

open

Image description of sys_file_reference is not translated in frontend

Added by Fabian Gassen 11 days ago. Updated 11 days ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2025-03-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

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.

Actual Result

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
Records Debug Output computedProperty localizedUid

The property is lost when toArray is called on the Record, which is what gets fed to the FileProcessor.
Data Debug Output without _LOCALIZED_UID

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()];
    }


Files

TYPO3_BugRecordsDebug.png (154 KB) TYPO3_BugRecordsDebug.png Records Debug Output computedProperty localizedUid Fabian Gassen, 2025-03-04 14:28
TYPO3_BugDataDebug.png (430 KB) TYPO3_BugDataDebug.png Data Debug Output without _LOCALIZED_UID Fabian Gassen, 2025-03-04 14:28
TYPO3_BugComparison.png (135 KB) TYPO3_BugComparison.png Actual Result Fabian Gassen, 2025-03-04 14:28
TYPO3_BugBackend.png (115 KB) TYPO3_BugBackend.png Fabian Gassen, 2025-03-04 14:48
Actions #1

Updated by Gerrit Code Review 11 days ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/88482

Actions

Also available in: Atom PDF