#84618Not possible to translate a record when allowLanguageSynchronization is set for relation field like 'image' in tt_content
Description
Szenario:
tt_content record of type image in default language with one image (default language en)
translated tt_content record in one language with individual image(s) selected in this record (language dk)
Action:
translate the record in a third language with selecting the translated (dk) record as source.
Expectation:
A translated record is created with sync set to translation source
Actual:
exception is thrown and image(s) in dk record is multiplied
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] Not possible to translate a record when allowLanguageSynchronization is set for relation field like 'image' in tt_content Resolves: #84618 Releases: main
Related issues 1
History 8
-
Frans Saris changed Related to #84998 <span data-processor="relativetime" data-value="2018-05-14T11:59:16+00:00" > 05/14/18, 11:59 </span>
-
Nicole Hummel commented and changed status
NewAccepted <span data-processor="relativetime" data-value="2018-09-09T19:43:01+00:00" > 09/09/18, 19:43 </span>Behavior in current master: the overlay is never hidden anymore. An exception is thrown but not display anywhere. I had even three images assigned to the existing database record (dk)
-
Susanne Moog changed Sprint Focus On Location Sprint <span data-processor="relativetime" data-value="2020-01-12T12:51:50+00:00" > 01/12/20, 12:51 </span>
-
Susanne Moog changed category <span data-processor="relativetime" data-value="2020-03-26T08:20:20+00:00" > 03/26/20, 08:20 </span>
-
Oliver Hader changed Sprint Focus
On Location Sprint<span data-processor="relativetime" data-value="2022-11-03T09:04:19+00:00" > 11/03/22, 09:04 </span> -
Riccardo De Contardi commented <span data-processor="relativetime" data-value="2024-04-27T19:59:38+00:00" > 04/27/24, 19:59 </span>
I’ve not understood how to reproduce this one on the latest main (13.2.0-dev) but maybe I am doing something wrong
My scenario:
- TYPO3 13.2.0-dev
- Three languages: Italian (uid=0), English (uid=1), French (uid=2)
- A page translated in all three languages
Test procedure
- On the page, create a “Text and Image” Content element in the default language (uid=0) ; add an image, Save and close
- Translate the content element in English (uid=1) (connected mode) and add another image only in english, save and close
- Translate the content element in French (uid=2) (connected mode), selecting english (uid=1) ad the source language , save and close
Results
- The record in the default (uid=0) language has ONE image
- The record in the (uid=1) language has TWO images
- The record in the (uid=2) language has THE SAME TWO images
- No duplicated images
- No error as far as I can tell
Is a different test necessary?
NOTE:
In the page module > Language comparison > All languages on, the column on the “French” language I still see the “Translate button” but it is broken:
If I click on it, it opens the translation wizard modal window but… it is empty! (There are no records left to translate); moreover the “next” button is still clickable, and it leads to an infinite-spinning empty “processing” modal. This is a known bug https://forge.typo3.org/issues/97763 -
Benni Mack commented <span data-processor="relativetime" data-value="2026-10-30T16:56:04+00:00" > 10/30/26, 16:56 </span>
I dug into this: Still valid on main / v15.
The scenario in the comment above did not enable
allowLanguageSynchronizationon the field, which is what triggers the problem. Reproduced on main with a functional test:- Enable
'behaviour' => ['allowLanguageSynchronization' => true]fortt_content.image - Translate a content element with two images to language 1 (connected mode)
- In the translation, switch the image field to “custom” and add a third image, which exists in language 1 only
- Translate the language 1 record to language 2, using language 1 as source
Result:
RuntimeException: Child record was not processed(1486233164) inDataMapProcessor::synchronizeReferences(), and an unclean reference index.Cause
The problem is not “translating a child from a non-default language” in general. Children of the language 1 record that are translations of default language children work fine: their language 2 copies point to the same default language record via
l10n_parent, andDataMapProcessorfollows that chain.It fails only for children that originate in a translation, here the image added in language 1 only. That child has
l10n_parent = 0, and so does its language 2 copy. Nothing points from the copy back to its source child:sys_file_referencehas neithertranslationSource(l10n_source) nororigUid(t3_origuid)DataMapProcessor::fetchDependentElements()only considers connected-mode records (l10n_parent > 0), so even a translation source pointer would be ignored for such rows
DataHandler::localizeRecord()already creates the language 2 copy of the child.DataMapProcessorcannot find it, considers the child missing, tries to localize it a second time, the nested-call guard ofDataHandler::localize()returns false, and the exception is thrown.Parent records do not have this problem: a parent without
l10n_parentis in free mode and not synchronized at all. The gap only exists one level down, for children owned by a connected translation in custom mode.Options
*A) Pair the copies without a pointer (no schema change)*
When a new translation is created, the copies of all children already exist in the same order as the source children. Children withoutl10n_parentcould be paired with their copies by position, similar to the existing “re-use sanitized value” shortcut insynchronizeReferences().- (+) No new column, can be backported
- (-) Only works while the translation is created. On every later save of the source translation, the copies cannot be matched: they would be deleted and localized again with new uids. #88452 treated the same behaviour as a bug for monoglot children.
origUidfor synchronized child tables*
@DataHandler::localizeRecord()@ already sets the origin pointer if the table has one. TheTcaPreparationstep from #88452, which enforcesorigUidfor monoglot child tables, would also cover language-aware child tables.DataMapProcessorthen matches children withoutl10n_parentthrought3_origuid, restricted to the children already attached to the parent translation.- (+) Stable uids, reuses the mechanism of #88452
- (+) Does not change the translation semantics of the child table: code reading
translationSource(FormEngine, LocalizationRepository, workspaces, impexp) is not affected - (-) New column
t3_origuidonsys_file_referencein every installation, sincepages.mediasynchronizes its references by default. Main only.
translationSource(l10n_source) for synchronized child tables*
Same as B, usingl10n_sourceas pointer.- (+) Stable uids
- (-) New column
l10n_sourceonsys_file_referencein every install - (-) Adds translation semantics to child tables, which affects every consumer of
translationSource
- (-) Does not help on its own:
DataMapProcessorignores pointers on , so reconfiguring the child table changes nothing without a core change - (-) Would flag every installation, because of
pages.media - (-) The problem depends on data (a translation in custom mode with owation source), not only on configuration
- (-) EXT:reports is optional
- Enable
Same scenario works well with text fields, but not with relational fields