Project

General

Profile

Actions

Bug #92768

closed

Extbase: Localized Children records are not working when parent element has sys_language_uid=-1

Added by Alex Kellner over 3 years ago. Updated 6 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-11-04
Due date:
% Done:

100%

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

Description

Hi guys,

While upgrading TYPO3 (from 8 to 10) website of $university we are facing some strange localization behaviours.
In this case, we try to localize children records (in own extbase plugin) while parent elements have a language setting "all". Localization is not possible any more (means: the labels are not shown in frontend in the additional language). We would have to localize also every parent record in all languages that are needed for children records (even if database values are the same).

I also experienced the same issue with powermail records in the latest TYPO3 10.4.9. Changing the fallback mode in site configuration for the additional languages seems to have no effect here.

Greetings, Alex


Files

clipboard-202307121349-kbux9.png (341 KB) clipboard-202307121349-kbux9.png André Buchmann, 2023-07-12 11:49
clipboard-202307121358-cyvku.png (392 KB) clipboard-202307121358-cyvku.png André Buchmann, 2023-07-12 11:58
clipboard-202307121402-16wer.png (127 KB) clipboard-202307121402-16wer.png André Buchmann, 2023-07-12 12:02
parent-child-translation.zip (13.5 KB) parent-child-translation.zip André Buchmann, 2023-07-12 12:15

Related issues 4 (1 open3 closed)

Related to TYPO3 Core - Bug #92757: Localization from language "All" should not be possibleClosed2020-11-03

Actions
Related to TYPO3 Core - Task #101884: Remove unwanted `use function` php importsClosedStefan Bürk2023-09-08

Actions
Related to TYPO3 Core - Epic #101557: Translation Handling FindingsNew2023-08-03

Actions
Related to TYPO3 Core - Bug #88887: DataMapper: Don't pass language -1 to child query using consistentTranslationOverlayHandlingClosed2019-08-01

Actions
Actions #1

Updated by Alex Kellner over 3 years ago

  • Description updated (diff)

Update to clearify

Actions #2

Updated by Georg Ringer over 3 years ago

  • Related to Bug #92757: Localization from language "All" should not be possible added
Actions #3

Updated by Georg Ringer over 3 years ago

  • Status changed from New to Needs Feedback

Thanks for creating the issue. I guess it is related to #92757. IMO localization should not be possible for records with language set to all, does that make sense to you?

Actions #4

Updated by Alex Kellner over 3 years ago

Thx for asking Georg.

I just reflected with the customer (just for your information: Communication department of a University which manage 2300 editors for 60K pages).
Ok, on the one hand it is a breaking change while upgrading, but on the other hand it's hard to understand why it should not be possible that records can not be translated only because the parent is set to "all languages" (from an editor point of view).

Alex

Actions #5

Updated by Dmitry Dulepov over 3 years ago

Alex Kellner wrote in #note-4:

Ok, on the one hand it is a breaking change while upgrading, but on the other hand it's hard to understand why it should not be possible that records can not be translated only because the parent is set to "all languages" (from an editor point of view).

It is described in the documentation (https://docs.typo3.org/m/typo3/guide-frontendlocalization/master/en-us/LocalizedContent/Index.html#the-all-language):

When using overlays, it becomes possible to use a particular language called “All”, which will be automatically visible across all translations. The uid of that particular language is “-1”. Note that no “Translate” button appears, the new content element is valid for all languages.

I am not sure how you translate it but you definitely not using TYPO3 translation algorithm because TYPO3 will refuse to localize from language with uid=-1. So I believe you have an error in your code. Language "All" is not translatable and it was never translatable. Please, fix your code.

This is not a bug in TYPO3. Sorry.

Actions #6

Updated by Jonas Eberle over 3 years ago

While it should not be possible, it still is in 2 ways which both lead to an inconsistent database:

1)
  • Create content in default language
  • Translate
  • Set default content to [All languages]
2)
  • Create content as [All languages]
  • Create content in translated language
  • Set "Transl. Orig." field to the [All languages] content

I think at least 2) should be easy to fix.

Actions #7

Updated by Dmitry Dulepov over 3 years ago

Language "All" is not translatable by design. Have a look to the docs.

Actions #8

Updated by Jonas Eberle over 3 years ago

@Dmitry Dulepov: it should not, but it is. It won't work and will of course have all kinds of unexpected side effects but editors can create such a bad state. We could (and should IMHO) improve DataHandler and Backend UI to prevent that.

Actions #9

Updated by Dmitry Dulepov over 3 years ago

Jonas Eberle wrote in #note-8:

I fully agree with fixing value combinations that should not appear!

Actions #10

Updated by Stephan Bauer over 2 years ago

I'm having the same problem. It worked in v8 but not in v10.

@Jonas & Dimitry

I think you misunderstood what Alex ment.
Not elements with language 'all' should be translated but child records of this elements.
E.g.
Parent element 'Manufacturer' => language 'all' because no translation neccessary.
Child element 'Country' => Translate e.g. '0'->Germany, '1'->Deutschland.

Actions #11

Updated by Philipp Idler almost 2 years ago

Facing exact same problem right now.

We have one (parent) record with sys_language_uid="-1" set (as there is no need to translate). Translated children of that record only displayed in default language.

- parent record (sys_language_uid = 1)
- child record translated in several languages (sys_language_uid 0,1,2, ...)

Result: Child record is displayed in default language (no matter what site language is set)

Actions #12

Updated by Philipp Idler over 1 year ago

I found the related piece of code in core:
11: https://github.com/TYPO3/typo3/blob/v11.5.17/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php#L404
10: https://github.com/TYPO3/typo3/blob/10.4/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php#L460

At these lines extbase's datamapper sets language for the child object to parent's object language. I miss the point why :-)
Even if findByUid() method is used, all objects should be translated to current website's language (except languageOverlayMode was set to false).

Updated by André Buchmann about 1 year ago

I can confirm this issue with TYPO3 11 and 13.0.0-dev.

Following test case was created to reproduce the problems:

1. We have three "Child" elements in our sysfolder which are translated.
2. There are two "Parent" (Model: Main) elements with All-languages (sys_language_uid=-1), that can have a direct relation to a "Child" but can also have an IRRE element "Squeeze" (squeezes in between child and parent ;-)).
3. Each "Squeeze" is in All-Languages (sys_language_uid=-1) also and has a "Child" selected.

Here an overview of the records:

Main Problem is, that the "Child" Elements of the "Squeeze" elements do not get translated into the target language. Whereas they get translated for the "Parent" elements. This is inconsistent.

The lines @Philipp Idler pointed out are changed in v12 and in my tests you can see a different behavior in v13.0.0-dev(main).
As you can see in the test case, that in 11 the "Kind 1 DE" element of the first "Squeeze" is loaded from some ?cache? again and therefore gets translated if the parent has the same "Child" assigned?!

Testcase in TYPO3 11.5.29:

Testcase in TYPO3 13.0.0-dev:

Dummy extension can be found on github: https://github.com/schliesser/parent-child-translation
or download the zip. Should be compatible from 11.5 - 13.x

Actions #14

Updated by Gerrit Code Review about 1 year ago

  • Status changed from Needs Feedback to Under Review

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

Actions #15

Updated by Gerrit Code Review about 1 year ago

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

Actions #16

Updated by Gerrit Code Review about 1 year ago

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

Actions #17

Updated by André Buchmann about 1 year ago

The difference between layer 1 and layer 2 "Childs" is, that in the DataMapper $this->query->getQuerySettings()->getRespectSysLanguage() (source) is false on the second layer. This is due to the fact that $query->getQuerySettings()->setRespectSysLanguage(false); is called in line 406 The setting gets transferred to $this->query when the query is executed.

I think this is fine for elements that are actually translated and called in that language then. But if the second/third layer is set to all languages (-1), the override of the languageId doesn't make sense. Better keep the initial language.

There should also be tests for this scenario, but I'm not sure how to provide the necessary TCA etc for testing? Therefore my patch comes currently without tests.

Actions #18

Updated by Gerrit Code Review about 1 year ago

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

Actions #19

Updated by Gerrit Code Review 12 months ago

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

Actions #20

Updated by Gerrit Code Review 12 months ago

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

Actions #21

Updated by Gerrit Code Review 12 months ago

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

Actions #22

Updated by Gerrit Code Review 12 months ago

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

Actions #23

Updated by Gerrit Code Review 12 months ago

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

Actions #24

Updated by Gerrit Code Review 12 months ago

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

Actions #25

Updated by Gerrit Code Review 12 months ago

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

Actions #26

Updated by Gerrit Code Review 12 months ago

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

Actions #27

Updated by Gerrit Code Review 10 months ago

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

Actions #28

Updated by Gerrit Code Review 10 months ago

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

Actions #29

Updated by Gerrit Code Review 10 months 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/+/80929

Actions #30

Updated by Gerrit Code Review 10 months ago

Patch set 2 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/+/80929

Actions #31

Updated by André Buchmann 10 months ago

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

Updated by Stefan Bürk 10 months ago

  • Related to Task #101884: Remove unwanted `use function` php imports added
Actions #33

Updated by André Buchmann 9 months ago

  • Related to Epic #101557: Translation Handling Findings added
Actions #34

Updated by Benni Mack 7 months ago

  • Related to Bug #88887: DataMapper: Don't pass language -1 to child query using consistentTranslationOverlayHandling added
Actions #35

Updated by Benni Mack 6 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF