Project

General

Profile

Actions

Bug #83469

closed

Translation of translations break sorting in tt_content

Added by Armin Vieweg about 6 years ago. Updated over 1 year ago.

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

100%

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 8 (2 open6 closed)

Related to TYPO3 Core - Bug #73617: Sorting of translation-copy different from originalClosedAndreas Kienast2016-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 sourceClosed2017-11-24

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

Actions
Related to TYPO3 Core - Bug #78220: Translate mode copy does not respect orderClosed2016-10-10

Actions
Related to TYPO3 Core - Bug #81328: Translation didn't sort Elements correct. Needs Feedback2017-05-24

Actions
Related to TYPO3 Core - Bug #93968: false order of localized CE in BE view / "Translate" button is shown but no translateable CE are availableClosed2021-04-22

Actions
Related to TYPO3 Core - Bug #86059: Wrong sorting for localized entries in page module with 8.7.16 and higherClosed2018-08-31

Actions
Actions #1

Updated by Armin Vieweg about 6 years ago

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

Updated by Armin Vieweg about 6 years ago

  • Description updated (diff)
Actions #3

Updated by Susanne Moog about 6 years ago

  • Category set to DataHandler aka TCEmain
Actions #4

Updated by Andreas Wolf about 6 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? :)

Actions #5

Updated by Armin Vieweg about 6 years ago

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

Actions #6

Updated by Armin Vieweg about 6 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.

Actions #7

Updated by Armin Vieweg about 6 years ago

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

Actions #8

Updated by Armin Vieweg about 6 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.

Actions #9

Updated by Armin Vieweg about 6 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.

Actions #10

Updated by Gerrit Code Review about 6 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

Actions #11

Updated by Gerrit Code Review about 6 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

Actions #12

Updated by Gerrit Code Review about 6 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

Actions #13

Updated by Gerrit Code Review about 6 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

Actions #14

Updated by Gerrit Code Review about 6 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

Actions #15

Updated by Gerrit Code Review about 6 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

Actions #16

Updated by Gerrit Code Review about 6 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

Actions #17

Updated by Riccardo De Contardi about 6 years ago

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

Updated by Gerrit Code Review about 6 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

Actions #19

Updated by Gerrit Code Review about 6 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

Actions #20

Updated by Gerrit Code Review about 6 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

Actions #21

Updated by Gerrit Code Review about 6 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

Actions #22

Updated by Gerrit Code Review about 6 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

Actions #23

Updated by Gerrit Code Review about 6 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

Actions #24

Updated by Gerrit Code Review about 6 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

Actions #25

Updated by Tymoteusz Motylewski over 5 years ago

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

Updated by Tymoteusz Motylewski over 5 years ago

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

Updated by Gerrit Code Review over 5 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

Actions #28

Updated by Daniel Goerz over 4 years ago

  • Status changed from Under Review to Closed

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

Please continue there.

Actions #29

Updated by Gerrit Code Review over 2 years ago

  • Status changed from Closed to Under Review

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

Actions #30

Updated by Gerrit Code Review over 2 years ago

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

Actions #31

Updated by Christian Kuhn over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #32

Updated by Christian Kuhn about 2 years ago

  • Related to Bug #78220: Translate mode copy does not respect order added
Actions #33

Updated by Christian Kuhn about 2 years ago

  • Related to Bug #81328: Translation didn't sort Elements correct. added
Actions #34

Updated by Christian Kuhn about 2 years ago

  • Related to Bug #93968: false order of localized CE in BE view / "Translate" button is shown but no translateable CE are available added
Actions #35

Updated by Christian Kuhn about 2 years ago

  • Related to Bug #86059: Wrong sorting for localized entries in page module with 8.7.16 and higher added
Actions #36

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF