Bug #78599
closedCopy localized content element leads to wrong reference, translation fails
Added by Markus Mächler about 8 years ago. Updated about 6 years ago.
100%
Description
the following steps:
- create a new page "P.A"
- create a new content element "CE.A" on page "P.A"
- localize "CE.A" to "CE.A en"
- create a new page "P.B"
- add a new content element "CE.B" on page "P.B"
- copy "CE.A" to page "P.B" to "CE.A copy". this automatically copies "CE.A en" to "CE.A en copy".
the copied, translated element "CE.A en copy" does have a correct l18n_parent "CE.A copy" set, however, the t3_origuid points to "CE.A en", instead of "CE.A copy".
if you now hit the "translate" button on page "P.B", it results in "A en copy" being translated by the localization wizard over and over, leading to many copies of "A en copy" instead of translating "CE.B"
this was tested with TYPO3 7.6.12,7.6.13-dev without any extensions installed.
Updated by Markus Mächler about 8 years ago
the proposed solution is to either
- set the origuid field of the copied localized record accordingly
or
- use transOrigPointerField in https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php#L144
Updated by Markus Mächler about 8 years ago
the records leading to the incorrect translation handling can be found with the following query,
which is used in https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php#L34:
SELECT * FROM tt_content,tt_content AS tt_content_orig,sys_language
WHERE
tt_content.colPos = 0
AND tt_content.sys_language_uid = 1
AND tt_content.t3_origuid = tt_content_orig.uid
AND tt_content_orig.sys_language_uid=sys_language.uid
AND tt_content.deleted=0
AND (tt_content.t3ver_state <= 0 OR tt_content.t3ver_wsid = 0)
Updated by Markus Mächler about 8 years ago
a deeper analysis revealed that
the "A en copy" record leads to the wrong original language being selected in
which is invoked in
and therefore leading to the wrong selection in https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php#L144
Updated by Gerrit Code Review about 8 years ago
- Status changed from New to Under Review
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/50532
Updated by Tymoteusz Motylewski about 8 years ago
Hi Markus,
Can you take a look if patch https://review.typo3.org/#/c/47645/ solves your issue?
Updated by Markus Mächler about 8 years ago
hi Tymoteusz
i tried your patch and unfortunately, the problem still persists.
as far as i can understand, the problem lies in the usage of two different fields `l18n_parent` in sysext/core/Classes/DataHandling/DataHandler.php
and `t3_origuid` in sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php for the very same purpose.
IMHO this really needs to be fixed in order to avoid translation issues.
Updated by Markus Mächler about 8 years ago
Imporant to notice: the Problem exists in TYPO3 7.6.12, 7.6.13-dev, as well as in TYPO3 8.5-dev, including the patch version https://review.typo3.org/#/c/47645/
Updated by Tymoteusz Motylewski about 8 years ago
Thanks for the feedback.
I can reproduce the issue.
Updated by Tymoteusz Motylewski about 8 years ago
Few notes:
- l18n_parent/l10n_parent/transOrigPointerField is always set to id of the record in the default language
- it is possible to translate content from different language than default. Because of that we can't just blindly replace t3_origuid usage with l18n_parent in the patch.
Updated by Markus Mächler about 8 years ago
hi tymoteusz
thanks for your reply.
if you want to use t3_origuid, then we need to make sure it is correctly set when copying a content element. this is currently not the case as described in the initial issue message.
so how do you want to proceed?
Updated by Oliver Hader about 8 years ago
We need to re-think the usage of t3_origuid as source for translations. This combined mode of localize & copy shows a severe conceptual flaw. Instead of adding another custom interpretation, this intentions need to be clear.
Updated by Markus Mächler about 8 years ago
ok so who will fix this issue and how?
Updated by Tymoteusz Motylewski almost 8 years ago
I spend some time investigating the current and past usage of the t3_origuid field. I wrote tons of functional tests for it to see how it behaves in different scenarios.
I found out that it's not so easy to use it consistently for localization purposes unfortunately (now it's used in translation wizard).
So right now we have 2 solutions
1. adapt the definition of t3_origuid and fix the core to align with this definition
2. introduce a new field `l10n_origuid` with a clear meaning.
Please take a look at the document describing the details of the issue and possible solutions.
https://docs.google.com/document/d/1rv_P8nO1F2VvBEk3Tbb5zH6LuCXHUsgMo0csde6NGUQ/edit#
So far most of the core team is leaning for having a new field and use it in the translation wizard. - I've opened an issue for it
https://forge.typo3.org/issues/78169
However to improve the current situation in v7 we could do change the current queries done in translation wizard to be "more inteligent" and detect whether t3_origuid has usable value or not.
Updated by Markus Mächler almost 8 years ago
hey Tymoteusz
thanks for this excellent analysis!
as far as I am concerned about 7, I wrote an xclass implementing the changes i submitted in the patch, replacing the usage of t3_origuid with l18n_parent in the translation wizard, which works fine so far.
i suggest to have this fix for 7, as it is an easy and quick solution. in the case of records being translated from a record in a non-default language, it should not require too much additional code which also handles this case.
Updated by Tymoteusz Motylewski almost 8 years ago
The rough idea how to solve it would be:
1. First check if a record has l10n_parent (transOrigPointerField) set
2. if yes, use it
3. if not try to use t3_origuid, but double check if t3_origuid has correct value before using it
- it should be different than record uid
- target record (the one t3_origuid is pointing to) should be in different language then the current record
Updated by Markus Mächler almost 8 years ago
thanks for your suggestion, it sounds reasonable.
will you implement this?
Updated by Tymoteusz Motylewski almost 8 years ago
I'm working on fixing other issues right now, so I will not be able to implement this in the near future.
If you have time, feel free to improve your patch.
Updated by Markus Mächler almost 8 years ago
hey Tymoteusz
ok, i will try to improve the patch in order to fit your requirements.
Updated by Gerrit Code Review over 7 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/51406
Updated by Gerrit Code Review over 7 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/51406
Updated by Tymoteusz Motylewski over 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset a1abb8db5cfe0bc75c8adeaf9acbac4769a5a7a8.
Updated by Markus Mächler over 7 years ago
This still has not been backported to 7.6
Updated by Gerrit Code Review over 6 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 3 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 4 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 5 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 6 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 7 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 8 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 9 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 10 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 11 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 12 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 13 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Gerrit Code Review over 6 years ago
Patch set 14 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57628
Updated by Markus Klein over 6 years ago
- Status changed from Under Review to Resolved
Applied in changeset ddec32356f5b778394af273ccb2c0e0cb4839747.
Updated by Tymoteusz Motylewski over 6 years ago
- Related to Bug #83874: Localization manager wrongly chooses the same language to translate from as to translate to added