Issue Bug Closed

#111423LocalizationRepository::getRecordsToCopyDatabaseResult() stops at the first translation with l10n_source = 0

Marc Fink 11/12/26, 12:24 updated 11/18/26, 21:14

Description

Environment

- TYPO3 14.3.10 (code unchanged on ‘main’ as of 2026-11-12)

Steps to reproduce

1. Page with two languages. Translate several elements in connected mode.
2. Also have at least one element in the target language with l10n_source = 0, e.g. an element created directly in
the target language (free mode).
3. Page module → “Translate” → choose target and source language.

Expected

The content selection step lists only default-language elements that have no translation yet.

Actual

Elements that are already translated are offered again, depending on the database’s row order. Which ones are affected
changes with the order in which the database returns the target-language rows (the query has no ‘ORDER BY’).

On one of our pages: 61 target-language records, the first l10n_source = 0 at position 42. The wizard listed 20
elements as untranslated; 18 of them are already translated.

Cause

EXT:backend/Classes/Domain/Repository/Localization/LocalizationRepository.php (14.3.10, line 86):

while ($origUid = $originalUidsStatement->fetchOne()) {
    $originalUids[] = (int)$origUid;
}

fetchOne() returns 0 for a row with l10n_source = 0, which is faulty, so the loop ends early and all following
@l10n_source@ values are never collected. The records they point to are not excluded by the notIn('uid', ...)
condition.

Suggested fix

$originalUids = array_map('intval', $queryBuilder
    ->select('l10n_source')
    ->from('tt_content')
    ->where(
        // existing conditions
        $queryBuilder->expr()->gt('l10n_source', 0)
    )
    ->executeQuery()
    ->fetchFirstColumn());

(or while (($origUid = ...->fetchOne()) !== false) plus skipping 0).

Possibly related

The method only looks at l10n_source. Translations that have l18n_parent set but l10n_source = 0 are offered again even with the loop fixed. Checking
@l18n_parent@ as well would cover those. What happens when such an element is translated a second time through the
wizard was not tested.

Reviews 1

History 34

  1. Marc Fink changed subject # LocalizationRepository::getRecordsToCopyDatabaseResult() stops at the first translation with l10n_source = 0 LocalizationRepository::getRecordsToCopyDatabaseResult() stops at the first translation with l10n_source = 0 <span data-processor="relativetime" data-value="2026-11-12T12:29:06+00:00" > 11/12/26, 12:29 </span>

  2. Oliver Bartsch commented and changed status Under Review Closed <span data-processor="relativetime" data-value="2026-11-18T21:14:43+00:00" > 11/18/26, 21:14 </span>

    Hey,

    thanks for the detailed analysis, it is correct. In LocalizationRepository::getRecordsToCopyDatabaseResult() the loop while ($origUid = $originalUidsStatement->fetchOne()) stops at the first target-language row with l10n_source = 0. All l10n_source values after that row are never collected, so already translated elements are offered again. The query has no ORDER BY, which is why the affected elements change with the row order.

    This is the same problem as #92937, which is still open, so I’m closing this one as a duplicate. Let’s continue there.

    Cheers, Oli