#111353Copying a translated record creates duplicate translations of records referenced with localizeReferencesAtParentLocalization
Description
If a select or group field is configured with localizeReferencesAtParentLocalization = true, copying a record together with its translation creates a new translation of every record referenced in this field, although the referenced translation already exists. Every further copy adds another duplicate.
The backend shows only one translation of the referenced record, because translation lookups use LIMIT 1. In the select field of the translated record, however, the duplicates show up as additional, identical items.
Preconditions
- A site with a default language (0) and a second language (1)
- Two language-aware tables, e.g.
tx_news_domain_model_newsandtx_eventnews_domain_model_organizer - A select (or group) field without MM that references the second table, with
localizeReferencesAtParentLocalizationenabled:
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['organizer']['config'] = [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_eventnews_domain_model_organizer',
'localizeReferencesAtParentLocalization' => true,
];
Steps to reproduce
- Create an organizer (uid 1) in the default language and translate it into language 1 (uid 2).
- Create a news record in the default language with
organizer = 1. - Translate the news record into language 1. The translation correctly references
organizer = 2. - Copy the default language news record (e.g. copy & paste in the list module). Its translation is copied as well.
Expected result
The copied translation references the existing organizer translation (uid 2). No new organizer record is created.
Actual result
A new organizer record (uid 3, sys_language_uid = 1, l10n_parent = 1) is created, and the copied translation references it. Every further copy creates another one.
Cause
When the translation is copied, copyRecord_processManyToMany() is called with $language = 1. The field value already contains the translated uid 2. The method looks for a translation of uid 2 in language 1 (l10n_parent = 2), finds none and calls localize() for uid 2. localize() takes over the l10n_parent of uid 2 (= 1) and creates another translation of uid 1.
Reviews 1
History 02
-
Gerrit Code Review pushed patch set 1 for main to change 97376 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-05T18:28:56+00:00" > 11/05/26, 18:28 </span> -
Gerrit Code Review pushed patch set 2 for main to change 97376 <span data-processor="relativetime" data-value="2026-11-10T06:19:42+00:00" > 11/10/26, 06:19 </span>