Bug #90430

Language handling of bidirectional mm selects is not consitent.

Added by Eike Starkmann almost 2 years ago. Updated about 2 months ago.

Status:
Under Review
Priority:
Must have
Category:
Extbase + l10n
Target version:
-
Start date:
2020-02-19
Due date:
% Done:

0%

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

Description

I found a inconsistent behaviour in the new language handling of typo3 9.5. The situation is like this, I have a bidirectional mm relation with selects on both sides, which are excluded in non default languages. I adapted it to the blog example.
So lets say we have posts and tags which can be selected on both sides.

I reproduced this behaviour in blog_example:
https://github.com/undkonsorten/blog_example/commit/4bcdae43cf750c98f6f39fc4864430d202bf2891

Scenario:

I create a blog post (P) with uid 1
I create a tag (T) with uid 11
I create a translation P' for P with uid 2
I create a translation T' for T with uid 12

I open P (default language) and add T.

Database looks like this:

uid_local    uid_foreign
1            11
2            11

P <=> T
P' <=> T

I open T (default language) and save it.

Database looks like this:

uid_local    uid_foreign
1            11
1            12

P <=> T
P <=> T'

Save P' or T':
uid_local    uid_foreign
1            11
1            12
2            12
2            11

P <=> T
P <=> T'
P' <=> T
P' <=> T'

The problem is that when I save T the tag is no longer shown on that post in Frontend.

The modified extension can be found here:
https://github.com/undkonsorten/blog_example/


Related issues

Related to TYPO3 Core - Bug #84682: TYPO3 8 Relationship Localization BugNew2018-04-10

Actions
Related to TYPO3 Core - Bug #65859: Support l10n_mode in extbaseNew2015-03-20

Actions
#1

Updated by Oliver Hader almost 2 years ago

  • Status changed from New to Needs Feedback

Thanks for your report, I've got a couple of questions - please see below

Eike Starkmann wrote:

I found a inconsistent behaviour in the new language handling of typo3 9.5.

Are you referring to changes for l10n_mode in TYPO3 v8 in the backend (DataHandler et al) or the introduced site language handling in TYPO3 v9?

I open P (default language) and add T.

How are entities/records modifies? Does that happen only in Extbase or can it be reproduced in the TYPO3 backend as well?

#2

Updated by Eike Starkmann almost 2 years ago

Oliver Hader wrote:

Thanks for your report, I've got a couple of questions - please see below

Eike Starkmann wrote:

I found a inconsistent behaviour in the new language handling of typo3 9.5.

Are you referring to changes for l10n_mode in TYPO3 v8 in the backend (DataHandler et al) or the introduced site language handling in TYPO3 v9?

I'm refering the new language handling introduced in TYPO3 v9.

I open P (default language) and add T.

How are entities/records modifies? Does that happen only in Extbase or can it be reproduced in the TYPO3 backend as well?

They are modified in backend.

#3

Updated by Eike Starkmann over 1 year ago

I think this might be related to #90925

I will test soon if this problem still exists in 9.5.16

#4

Updated by Stefan P over 1 year ago

  • Priority changed from Should have to Must have

I can confirm this (or some related) behaviour. I have this situation:

I have a tree. Each record has a renderType tree field where its parent is stored. The L=1 records store there the uid of the translated(!) parent. This is done by DataHandler itself (I import the records into the database by using DataHandler and also use the DataHandler to localize them).

The parent/tree field is l10n_mode => exlcude!

What happens then:

In Extbase and L=1 I say $parent->getChildren() -> I get all localized children. Perfect.

I then go into backend, and simply save one of the L=1 child records (no changes!). Backend shows everything fine, before and after. Seems perfect (but isn't).

Then: I say in Extbase and L=1 $parent->getChildren() -> the just saved record is MISSING!

What did change? The save in the backend changed the stored parent uid from the L=1 uid to the L=0 uid.

So, either DataHandler or Extbase have a bug here. Interesting to know would be why the Datahandler behaves differently when called from a click in BE or when called in a Command (import). Seems some l10n config is treated differently here.

#5

Updated by Stefan P over 1 year ago

If I remove l10n_mode => exclude it works suddenly. The backend then does not change the refenrecned uid upon saving (it stays the one of the L=1 parent) and Extbase still displays it in the frontend.

#6

Updated by Karsten Nowak (undkonsorten) over 1 year ago

Problem still exists in 9.5.20.

Today I tried to remove the l10n_mode setting. If I limit the selectable data to the current sys_language_uid of the record and set every relation in the translated records too, then the output in frontend is really correctly. But, I don't want editing every record twice if I add a new relation. Even more there are 3 or 4 relations to be add.

That can't be the solution.

I expect the output should be work also with l10n_mode exclude. And it does, but only when I save the data on the local side. If I save from the foreign side, then it's broken. Output in frontend is:

  • On default language page: the translated data of the relation (e.g. the title in english not german)
  • On translated page: no relations found.

I set up an ddev environment for local development for reproducing and analyzing the issue. There are a small extension with some simple models and relations between it. That makes it handy to understand the problem.

https://github.com/undkonsorten/dummymgmt-dev

Follow the Readme to setup the project. For questions I suggest slack. Write question to @karsten_uk

Here was the related Thread in Slack channel: https://typo3.slack.com/archives/C025BQLFA/p1598964529303700?thread_ts=1581514117.306000&cid=C025BQLFA

#7

Updated by Jan Kornblum over 1 year ago

I had a similar issue with bidirectional relations (1:n <-> n:1). Tried to figure out what the currently expected behaviour is for handling relations in extbase as well as in backend. Finally, i've found...

https://review.typo3.org/c/Packages/TYPO3.CMS/+/43147/
"The backend expects the localized uid as parent id but extbase currently saves the original uid"

https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/9-CrosscuttingConcerns/1-localizing-and-internationalizing-an-extension.html#typo3-v9-and-higher

For me it seems to:

- The backend still (10 LTS) expects the relation field to point to the translated record (because when pointing to the L=0 record, i've got inconsistences at least in backend IRRE view and localization wizard)
- l10n_mode=exclude for relation fields is currently not supported for backend
- l10n_mode=exclude for relation fields is currently not supported for extbase

Am i right?

#8

Updated by Wolfgang Klinger over 1 year ago

ping ping still a major problem
I don't feel able to solve this with this code base (DataHandler, Extbase), so no patch from me!

#9

Updated by Gerrit Code Review about 1 year ago

  • Status changed from Needs Feedback 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/c/Packages/TYPO3.CMS/+/67172

#10

Updated by Gerrit Code Review about 1 year 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/c/Packages/TYPO3.CMS/+/67172

#11

Updated by Jan Kornblum 8 months ago

  • Related to Bug #84682: TYPO3 8 Relationship Localization Bug added
#12

Updated by Michael Rainer 8 months ago

Is there any news?
The patch file is still under review, isn't it?

#13

Updated by Gerrit Code Review 6 months 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/c/Packages/TYPO3.CMS/+/67172

#14

Updated by Jan Kornblum 4 months ago

This issue schould be extended to "language handling in relations is not constistent" in general. For example, (bidirektional) inline relations (1:n inline <-> n:1 select) should be evaluated, too. Lets have "seminar" and "event" (seminar.events = 1:n inline, event.seminar = n:1 select). I've spent the whole day trying to get any TCA configuration where both relations are set to "l10n_mode=exclude", without success. I think the "relation + translation" handling should be checked completely, also in conjunction with extbase.

#15

Updated by Gerrit Code Review 4 months 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/c/Packages/TYPO3.CMS/+/67172

#16

Updated by Jan Kornblum 4 months ago

  • Related to Bug #65859: Support l10n_mode in extbase added
#17

Updated by Gerrit Code Review 2 months 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/c/Packages/TYPO3.CMS/+/67172

#18

Updated by Gerrit Code Review about 2 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/+/67172

Also available in: Atom PDF