Bug #86619

Extbase translation handling for detail page not working

Added by Martin Weymayer 2 months ago. Updated about 2 months ago.

Status:
Resolved
Priority:
Must have
Assignee:
-
Category:
Extbase + l10n
Target version:
-
Start date:
2018-10-10
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Detail view in extension are allways shown in default language. Steps to reproduce:
- install new 9.5 and use site configuration for "real url"
- install f.ex. extension news
- make some entries in default language and make localization of articles/news
- translate pages and content elments
- view list of news - > list view shows correct language translation
- click to view detail page - > content shown in default language, no translation

martin

Unbenannt-1.jpg View (340 KB) Martin Weymayer, 2018-10-10 17:57

Associated revisions

Revision 5e030596 (diff)
Added by Tymoteusz Motylewski about 2 months ago

[BUGFIX] Bring back findByUid behavior for L>0

findByUid as well as getObjectByIdentifier will always overlay records
to a language from the global context.

This solves the problem with controller arguments not being translated,
when default language record was used in the URL.

Resolves: #86619
Releases: master
Related: #82363
Change-Id: I823cdc1118a8217e306473b1596d349cc7ca08d4
Reviewed-on: https://review.typo3.org/58635
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Alexander Grein <>
Tested-by: Alexander Grein <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>

History

#1 Updated by Jonas Eberle 2 months ago

Could you add your TypoScript language config, so all relating to config.*lang*?

#2 Updated by Martin Weymayer 2 months ago

I use site configuration and have following setup added


[siteLanguage("languageId") == 1]
page.config.htmlTag_langKey = en
config {
        sys_language_uid = 1
        language = en
        locale_all = en_EN
        htmlTag_langKey = en-EN
}
[global]

!!

#3 Updated by Jonas Eberle 2 months ago

Sorry, I am out then. Didn't grasp site configurations yet.

#4 Updated by Tymoteusz Motylewski 2 months ago

  • Description updated (diff)

#5 Updated by Susanne Moog 2 months ago

Not really related to the bug, but a side note:
you should not need to set the typoscript settings anymore if you have a site configuration with configured languages.

#6 Updated by Martin Weymayer 2 months ago

Thanks, I know - I added ts because site configuration did not work and hoped ts is helping to solve bug :-)

#7 Updated by Alex Bigott 2 months ago

This is connected to the 'Important 82363' in the upgrade docs for 9.5

In every new install of 9.5 language handling changed.

As I found out this means in this special case that the findAll() method in the repository returns localized values (serving the 'list' view), whereas the findByUid() does not anymore (serving the 'detail' view).
I have the same problem in my extension and to be honest I am not sure if i think this is a good idea.

If you want your old behaviour back and the extension working, you can set the following TypoScript switch:
config.tx_extbase.features.consistentTranslationOverlayHandling = 0

Cheers

Alex

#8 Updated by Martin Weymayer 2 months ago

Thanks! But does the switch-back effect "new" translation handling? If yes, I do not think it is good idea to mix old an new ...

#9 Updated by Alex Bigott 2 months ago

Exactely my thoughs. This makes me shrug as well.

#10 Updated by Tymoteusz Motylewski 2 months ago

  • Category set to Extbase + l10n

I confirm the issue, will take a look what can we do to lower the hassle for integrators/developers.

#11 Updated by Martin Weymayer 2 months ago

Thanks!

#12 Updated by Alex Bigott 2 months ago

The longer I look into this issue, the more I think there is something seriously broken here.

For me this feels like a huge step back in the way extension developers are working, since from now on fundamentals of how to work in extbase are broken, not to mention that the current status will result in almost every extension there is not working in a fresh 9.5 install when it comes to multilingual projects.

Let's get back to the very core of this topic here: list views and details views (list and show).

On the very core:
  • in your list action you get all the records and give the result to a view:
    public function listAction()
    {
        $langtests = $this->langtestRepository->findAll();
        $this->view->assign('langtests', $langtests);
    }
    
  • next in your view you have a for loop over the results and create links
    <f:for each="{langtests}" as="langtest">
        <f:link.action action="show" arguments="{langtest : langtest}"> {langtest.title}</f:link.action>
    </f:for>
    
  • in the show action you continue the easiest way
    public function showAction(\Alex\Langtest\Domain\Model\Langtest $langtest)
    {
        $this->view->assign('langtest', $langtest);
    }
    
  • and finally the show view displays all
        {langtest.title}
    

And guess what: this does not work anymore!

In the details/show view you will always get the default language and not a translation. This is not just an inconvenience for the developer in my eyes. This is wrong to me.

#13 Updated by Tymoteusz Motylewski 2 months ago

Hi
Here is a work in progress solution:
https://review.typo3.org/#/c/58635/

It fixes the issue if you have overlay mode set to "true" or "hideNonTrnaslated" for the website (in the global context).

I'm checking whether /how we should also fix the case when overlay mode is set to 0/false.
And other consequences.

This also shows that we desperately need tests for propertyMapper (object converter) which would cover cases when translated record is expected.
If any of you can/want to help in writing these tests, I would be very grateful.

#14 Updated by Gerrit Code Review 2 months ago

  • Status changed from New to Under Review

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/58635

#15 Updated by Gerrit Code Review 2 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/58635

#16 Updated by Gerrit Code Review 2 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/58635

#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/58635

#18 Updated by Gerrit Code Review about 2 months 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/58635

#19 Updated by Gerrit Code Review about 2 months 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/58635

#20 Updated by Gerrit Code Review about 2 months 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/58635

#21 Updated by Gerrit Code Review about 2 months 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/58635

#22 Updated by Gerrit Code Review about 2 months 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/58635

#23 Updated by Gerrit Code Review about 2 months 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/58635

#24 Updated by Markus Klein about 2 months ago

We kindly ask all involved persons in this issue to test the latest version of the patch.

#25 Updated by Tymoteusz Motylewski about 2 months ago

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

#26 Updated by Martin Weymayer about 2 months ago

thanks! tested and working correct now.

Also available in: Atom PDF