Review main Merged

88837[BUGFIX] Skip localization of children for non-language-aware tables

Torben Hansen CR +2 V +2 Expert +1037 −0 updated 04/11/26, 11:36

Commit message

When localizing a record (e.g. tt_content) whose IRRE field
references a non-language-aware (monoglot) child table,
DataHandler::localize() was called on that child, which logged
a "Localization failed" warning and returned false. The child
reference then stayed in $dbAnalysis->itemArray, and later
writeForeignField in the remapping phase would reassign the
original child record's parentid to the new localized parent,
corrupting the original record's relation and leaving a dirty
reference index.

The fix adds a check inside the localization branch of
copyRecord_processRelation: When the child table is not
language-aware, the child is removed from $dbAnalysis->itemArray
and skipped. This prevents both the failing localize() call and
the remapping from stealing the original child.

The monoglot child is then handled by process_datamap() through
the allowLanguageSynchronization or l10n_mode=exclude mechanism,
which copies the child as a new record (with sys_language_uid=0,
l18n_parent=0, t3_origuid pointing to the original) and assigns
it to the localized parent via parentid. The original child
stays untouched on its original parent.

The details of the scenario are still not sorted out and need
more thoughts. The tests document some possible directions.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Torben Hansen +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Torben Hansen +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 3

Files 22

Show 2 more files

Review log 2939

Show 914 earlier messages
  1. Torben Hansen uploaded patch set 1 03/29/25, 18:01

  2. core-ci voted on patch set 1 V -1 03/29/25, 18:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76645

  3. Benni Mack commented on patch set 1 03/29/25, 20:03

    Torben, this is a pandora's box. I recommend you have a chit-chat with Olly Hader first before spending too much time on it. (note: I'm not opposed of any changes in this area)
  4. Torben Hansen rebased onto patch set 2 V -1 05/26/25, 07:04

  5. core-ci voted on patch set 2 V -1 05/26/25, 07:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79468

  6. Torben Hansen commented on patch set 2 09/04/25, 16:35

    I abandon this patch, since extension authors will be able to use a new PSR-14 event (see https://review.typo3.org/c/Packages/TYPO3.CMS/+/88834) to exclude affected tables from the translation process
  7. Torben Hansen abandoned the change 09/04/25, 16:36

    See comment
  8. Benni Mack restored the change 02/20/26, 11:06

  9. Torben Hansen rebased onto patch set 3 V -1 02/20/26, 11:06

  10. Torben Hansen updated the commit message in patch set 4 02/20/26, 11:07

  11. Benni Mack commented on patch set 5 02/20/26, 11:20

    Published edit on patch set 4.
  12. core-ci voted on patch set 5 V -1 02/20/26, 11:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96342

  13. core-ci voted on patch set 4 V -1 02/20/26, 11:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96336

  14. core-ci voted on patch set 3 V -1 02/20/26, 11:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96335

  1. Benni Mack uploaded patch set 6 V -1 02/20/26, 22:57

  2. core-ci voted on patch set 6 V +1 02/20/26, 23:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96419

  3. André Buchmann uploaded patch set 7 V +1 02/24/26, 21:23

  4. core-ci voted on patch set 7 V +1 02/24/26, 21:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96778

  5. André Buchmann rebased onto patch set 8 V +1 02/25/26, 09:38

  6. core-ci voted on patch set 8 V +1 02/25/26, 09:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96807

  7. Torben Hansen commented on patch set 8 V +1 02/28/26, 12:38

    This patch fixes the shown error message a record with NLA child records is localized. My original intention with the patch was however, to completely skip localization of NLA records and also to prevent to create copies of those records which are shown in the localized child record. If we e.g. have a localization aware main record which has in inline field that contains 200 (NLA) records, why should we create copies of those 200 NLA records when the main record is localized to another language? This is also one of the two reasons for this feature (https://review.typo3.org/c/Packages/TYPO3.CMS/+/88834). I want to decide myself, if a field (in this case a field for NLA records) is taken into account during the DataHandler copy and localize process preventing "superfluous" data being created. Anyway, since the patch fixes the problem with the error message being shown, I think it is fine to merge it.
  8. Oliver Klee voted on patch set 8 V +1 02/28/26, 18:51

  9. Eric Harrer commented on patch set 8 03/06/26, 11:26

    Reply

    We discussed this today in the Translation Handling Initiative and came to the following conclusion: Inline children are directly linked to their parent. Even if they themselves are NLA, they must be kept synchronized across parent translations, otherwise the semantic character of the parent will change from one language version to another. Direct referencing of the same children across all parent translations would be possible via record selection (type=select). In the case of IRRE childs we need the creation of copies for NLA childs across all translations.
  10. Torben Hansen commented on patch set 8 03/06/26, 12:48

    Reply

    Depending on the amount of data, this results in having possible hundreds or thousands of unused records in the database, which at every change in the translatable parent record must be kept in sync. I understand this from a technical/framework perspective, but this is not really good in terms of: - data economy - possible performance problems in the superfluous sync process - unexpected/undocumented behavior for extension authors
  11. Eric Harrer commented on patch set 8 03/06/26, 17:28

    Reply

    Before the details, the central architectural trade-off is storage/write cost vs. runtime complexity: yes, the database gets larger, but query and fallback logic become simpler and less coupled across languages. On your three points: - data economy True, row count increases. But this is a deliberate trade-off to keep language records self-contained, instead of reusing shared NLA IRRE children across language layers. - possible performance problems in the superfluous sync process Also true: localization/update operations do more write/sync work. In return, read paths become simpler (fewer lookups, fewer fallback branches, less cross-language coupling). In read-heavy TYPO3 workloads, this can be a net runtime gain over a smaller DB with more complex fallback logic. - unexpected/undocumented behavior for extension authors I would separate this: the behavior itself is expected from the current model, but it should be documented much more explicitly. Localizing a parent with NLA IRRE children creates dedicated child copies per localized parent (no child localization), so extension authors can rely on clear and transparent semantics. To make the performance claim evidence-based, it would be useful to add benchmarks showing whether the simpler read path outweighs the additional sync/write and storage cost.
  12. Markus Klein commented on patch set 8 03/18/26, 19:29

    Reply

    I'm not sure, if I got all your points right, but one thing that should be added to the discussion. What's the l10n_mode of the irre-field in the parent? In my opinion: * if the irre-field is translatable => the non-localizable children are living separately per parent-translation. No sync of copy needed. * if the irre-field has mode=exclude => the non-localizable children are bound to the default-language parent. It's up for discussion if we really wanna sync those, especially if those are complex children, with possibly nested localizable irre-children. (I did not yet even think about the expected behavior for such a structure; I'd need a practical case first, I guess)
  13. Christian Kuhn uploaded patch set 9 V +1 04/10/26, 17:42

  14. Christian Kuhn commented on patch set 9 04/10/26, 17:51

    ok. torben, benni and me had quite an amount of thoughts in this area. patch set 9 now resets to the solution from set 6, and will see another few pushes to finish the patch. goal: solve the raised error and create a defined 'intermediate' state for inline "parent-is-localizable-but-child-is-not' scenario. we will create a solution that allows *NOT* copying the child records for now, and we will keep the current behavior when l10n_mode=exclude and/or allowLanguageSynchronization is set. Note these two are triggered low level by DataMapProcessor, not DH itself. The patch will point out details on what is funny with this. In general, I think it would be better to consistently copy or localize even monoglot tables, but only if we are able to keep the records in sync. But we have no good sync at the moment. Hopefully, we'll establish one in order to kill sys_language_uid=-1, and we could then maybe re-use or re-implement it for monoglot again, to fine tune the scenarios we establish with this patch now. We may also want to look at TCA ctrl again to make monoglot scenarios more explicit. And, BE UI should probably see adaptions as well since it for instance does not make sense to have the 'synchronization' buttons in inline in such cases, and localized parent records should never allow editing of monoglot children ... but well, that's later. for now we'll come up with a solution that solves the error and adds tests to document current behavior.
  15. Christian Kuhn commented on patch set 9 04/10/26, 17:52

    Reply

    yes. l10n_mode=exclude and allowLanguageSynchronization need thoughts in general and in this scenario as well. see my other comment on how we try to continue with this patch.
  16. core-ci voted on patch set 9 V +1 04/10/26, 18:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99927

  17. Christian Kuhn uploaded patch set 10 V +1 04/10/26, 18:34

  18. core-ci voted on patch set 10 V +1 04/10/26, 18:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99929

  19. Christian Kuhn voted on patch set 10 CR +1 V +1 04/10/26, 18:52

  20. Oliver Klee voted on patch set 10 V +1 04/11/26, 05:56

  21. Torben Hansen voted on patch set 10 CR +1 V +1 04/11/26, 06:53

  22. Christian Kuhn commented on patch set 10 CR +2 V +2 04/11/26, 07:02

    yay. DH code changes: 8 loc subject change with 1k loc tests. we'll pick this now and will try to finish the event patch afterwards. https://review.typo3.org/c/Packages/TYPO3.CMS/+/88834
  23. Christian Kuhn commented on patch set 10 CR +1 V +1 04/11/26, 07:03

    actually, let's wait for a missing vote. would be great if benni signs this off.
  24. Benni Mack voted on patch set 10 CR +2 V +2 04/11/26, 11:36

  25. Benni Mack merged patch set 11 04/11/26, 11:36