Review main Merged

94914[BUGFIX] Find translations with empty l10n_source

Stefan Bürk CR +2 V +2 Normal +52 −18 updated 08/01/26, 18:44

Commit message

LocalizationRepository::getRecordTranslation() and
getRecordTranslations() match existing translations by the
translationSource field (l10n_source) whenever the table defines
one, and fall back to the transOrigPointerField (l10n_parent)
only for tables without a translation source field.

A translation carrying a correct l10n_parent but an empty
l10n_source is therefore not found, although it is a valid
translation. Such records are created by TYPO3 itself: a
DataHandler datamap creating a translation by only setting the
language field and the transOrigPointerField does not populate
l10n_source, which is the usual way extensions, importers and
migrations create translations.

DataHandler::localize() uses this lookup to detect already
existing localizations. As the existing translation is invisible,
the guard does not trigger and a second translation of the same
record in the same language is created.

The lookup keeps preferring l10n_source, but additionally matches
records whose l10n_source is empty by their transOrigPointerField,
so no valid translation is lost.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Nikita Hovratov +1
    • Benni Mack +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Nikita Hovratov +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 810

  1. Stefan Bürk uploaded patch set 1 07/23/26, 23:19

  2. Stefan Bürk updated the commit message in patch set 2 07/23/26, 23:21

  3. core-ci voted on patch set 1 V +1 07/23/26, 23:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105269

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

  5. Stefan Bürk commented on patch set 2 07/23/26, 23:53

    Note for reviewers: the backports for 14.3 and 13.4 have already been pushed, because both need a modified approach and therefore require their own review and voting - they are not plain cherry-picks of this change: * 14.3: https://review.typo3.org/c/Packages/TYPO3.CMS/+/94916 Contains this change plus the same fix for BackendUtility::getRecordLocalization(), which still exists there (deprecated) and carries the identical expression. Covered by additional functional tests for both APIs. * 13.4: https://review.typo3.org/c/Packages/TYPO3.CMS/+/94915 LocalizationRepository::getRecordTranslation() does not exist in 13.4, so the fix applies solely to BackendUtility::getRecordLocalization(), with its own functional tests. All three share this Change-Id, so they are linked as backports.
  6. Oliver Klee voted on patch set 2 V +1 07/25/26, 13:23

  7. Nikita Hovratov commented on patch set 2 CR +1 V +1 08/01/26, 12:45

    Thanks for taking care Stefan! This should be quite straightforward.
  8. Benni Mack voted on patch set 2 CR +1 V +1 08/01/26, 13:57

  9. Stefan Bürk voted on patch set 2 CR +2 V +2 08/01/26, 18:44

  10. Stefan Bürk merged patch set 3 08/01/26, 18:44