Bug #83469

Translation of translations break sorting in tt_content

Added by Armin Vieweg almost 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2018-01-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I am able to reconstruct an issue with translation handling, in latest TYPO3 7.6 and 8.7!
I've got three languages (one is default).
When I translate from default to e.g. english using the strict translate mode, everything is fine.
When I translate from english to e.g. italian, the elements are created, but the order of items is wrong. And because of strict mode, you can't move them.

Is this a regression bug?

In 7.6 also the wizard displays the order wrong, before the tt_content items are created.
In 8.7 the wizard displays it correctly, but the order of created items, is wrong. (edited)

When I use default as base to translate, the order is correct.

Screenshot: https://slack-files.com/T024TUMLZ-F8N2MHG6Q-8e2d722cf3


Files

2018-01-31_0904.png (29.6 KB) 2018-01-31_0904.png Armin Vieweg, 2018-01-31 09:05
2018-01-31_0927.png (26 KB) 2018-01-31_0927.png Armin Vieweg, 2018-01-31 09:28
2018-01-31_0940.png (14.1 KB) 2018-01-31_0940.png Armin Vieweg, 2018-01-31 09:41

Related issues

Related to TYPO3 Core - Bug #73617: Sorting of translation-copy different from originalClosedAndreas Fernandez2016-02-23

Actions
Related to TYPO3 Core - Bug #81220: Translation from a language results in wrong sorting of CEsClosed2017-05-13

Actions
Related to TYPO3 Core - Bug #83079: wrong sorting of content elements when translating using non-default-language CEs as sourceUnder Review2017-11-24

Actions
Related to TYPO3 Core - Bug #68040: Inline localize and/or synchronize does not respect sortingUnder Review2018-03-142018-03-14

Actions
#1

Updated by Armin Vieweg almost 4 years ago

  • Related to Bug #73617: Sorting of translation-copy different from original added
#2

Updated by Armin Vieweg almost 4 years ago

  • Description updated (diff)
#3

Updated by Susanne Moog over 3 years ago

  • Category set to DataHandler aka TCEmain
#4

Updated by Andreas Wolf over 3 years ago

Armin, I suspect that this might be the same bug that is fixed by https://review.typo3.org/#/c/53739/. Could you be so kind and check that? :)

#5

Updated by Armin Vieweg over 3 years ago

Hey Andreas, I've checked it, and the behaviour is still the same :/

#6

Updated by Armin Vieweg over 3 years ago

I debugged a little bit. And this is the $cmd which is passed to DataHandler:

The order looks good to me.
The uids 5, 6 and 7 are the german A, B and C records.

#7

Updated by Armin Vieweg over 3 years ago

\TYPO3\CMS\Core\DataHandling\DataHandler::localize breaks sorting somewhere:

#8

Updated by Armin Vieweg over 3 years ago

I've digged into the getSortNumber method and tried to understand what happens.

So the mayor difference, is that the records used for calculating the sortNumber are differently selected.

When I translate three content elements from default language:
1. Checks sorting from first default record ($row) and its next sibling ($subrow)
2. Calculates new sortNumber ($sortNumber = $row[$sortRow] + floor(($subrow[$sortRow] - $row[$sortRow]) / 2);)
3. Create new translation record with calculated sortNumber
4. For the second record to translate, it compares the recently created record ($row) with the original sibling ($subrow), calulates and create new translated record
5. For the last record it also uses the recently created translated record and compares it still with the original sibling

When translating from a foreign language it behaves the same, but for the last record it uses NOT the latest translated record as $row, it uses the one before. The $subrow is the sibling of the latest translated record, which is (in this case, because of 3 items) the recently created translated record.

Long story short: I guess this happens because of negative PID voodoo. The pid is the only criteria used to calculate the sortNumber (besides existing sortNumbers itself). And localize in DataHandler seems to set pid to a negative value, which affects the sorting algorithm.

#9

Updated by Armin Vieweg over 3 years ago

Okay. After debugging a lot, I've found the point where it goes wrong:
\TYPO3\CMS\Core\DataHandling\DataHandler::getPreviousLocalizedRecordUid

In the query just default language is checked, to fetch sortings of records.
When you enter the $language variable, it works.

For translations from default AND from foreign language.

#10

Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#11

Updated by Gerrit Code Review over 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#12

Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55509

#13

Updated by Gerrit Code Review over 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55509

#14

Updated by Gerrit Code Review over 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55486

#15

Updated by Gerrit Code Review over 3 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#16

Updated by Gerrit Code Review over 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#17

Updated by Riccardo De Contardi over 3 years ago

  • Related to Bug #81220: Translation from a language results in wrong sorting of CEs added
#18

Updated by Gerrit Code Review over 3 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#19

Updated by Gerrit Code Review over 3 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#20

Updated by Gerrit Code Review over 3 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#21

Updated by Gerrit Code Review over 3 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#22

Updated by Gerrit Code Review over 3 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#23

Updated by Gerrit Code Review over 3 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#24

Updated by Gerrit Code Review over 3 years ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#25

Updated by Tymoteusz Motylewski about 3 years ago

  • Related to Bug #83079: wrong sorting of content elements when translating using non-default-language CEs as source added
#26

Updated by Tymoteusz Motylewski about 3 years ago

  • Related to Bug #68040: Inline localize and/or synchronize does not respect sorting added
#27

Updated by Gerrit Code Review almost 3 years ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55508

#28

Updated by Daniel Goerz almost 2 years ago

  • Status changed from Under Review to Closed

Closed as duplicate of https://forge.typo3.org/issues/83079

Please continue there.

Also available in: Atom PDF