Bug #86619

Extbase translation handling for detail page not working

Added by Martin Weymayer 8 days ago. Updated 2 days ago.

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

0%

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

History

#1 Updated by Jonas Eberle 8 days ago

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

#2 Updated by Martin Weymayer 8 days 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 8 days ago

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

#4 Updated by Tymoteusz Motylewski 7 days ago

  • Description updated (diff)

#5 Updated by Susanne Moog 6 days 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 6 days 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 6 days 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 6 days 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 6 days ago

Exactely my thoughs. This makes me shrug as well.

#10 Updated by Tymoteusz Motylewski 6 days 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 6 days ago

Thanks!

#12 Updated by Alex Bigott 5 days 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 3 days 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 3 days 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 3 days 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 3 days 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 days 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

Also available in: Atom PDF