-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX] Localization in flux:grid columns #1331
Conversation
The PHPUnit tests failed. Had no time to correct them. It's too late, good night ;-) |
Phew, this looks like way too much code to solve a bug (which by the way also exists in the TYPO3 core as far as I am aware). Though I'm all for solving bugs, I really don't think the right way to do it is to replace the entire controller, language resolving, ajax routing, JS and markup. There has to be a cleaner way which requires no overrides, or at least requires far fewer overrides? Maybe we can re-use the IRRE localisation call as a custom action in our "localise" button? When you localise nested content using the IRRE field (note: workspaces must not be installed or the field isn't shown, but you can still save the field - it's just not added to TCA showitem) as far as I'm aware, that does it correctly? Don't get me wrong, I very much appreciate the work you put into it, but we also have to maintain all this code, for multiple TYPO3 versions - so I'd much rather not override how the core does the localisation. Also, my knowledge in this area is limited (from a user perspective as well) so I don't know all the little details about how it is expected to work and what's causing it to not work for our case. I wish I could help more, but right now, "perhaps reuse the IRRE localize logic?" is the best I can do. |
@NamelessCoder Thanks for your statement. Did you mean for the 'IRRE localize logic' this method But we need here also own ajaxRoutes to fetch the correct informations for each flux:grid column. I do not expect major changes to the localization structures for TYPO3v9. None of the extended Classes and used methods are marked as deprecated except the The Localization Support is one of the big feature of TYPO3, so we have to bite the bullet ;-) |
18b09f5
to
d26b894
Compare
Since TYPO3v8.6 then new field 'l10n_source' stores the parent of the translated element. Bugfixes in
Bugfix in
Insert language mode detection in The PHPUnit tests are failing. They are corrected later. |
d26b894
to
bd0d0a9
Compare
Let's take a step back here - because this is absolutely massive as a bug fix. Basically we would be overriding the entire localisation logic and provide overrides for JS for two separate versions of TYPO3, and it all stems from a fairly simple problem. To analyse the problem:
Here's what I know about the above:
Specially about the third item: There's a VERY odd side effect in TYPO3 regarding the "tt_content as IRRE" relation we use for tx_flux_children. The problem is that when you perform an action which generates a new version or a copy of a parent record, children do get processed as well - but they end up with odd sorting numbers. Rather than being generously spaced like tt_content sorting values normally are, they become perfectly sequential (and not in the order of the original sorting value). This may be playing into the result you see after a copy operation and it definitely affects records you copy/paste in workspaces mode. I've attempted to correct that problem by having Flux copy the sorting number from the original child record to the new copy, after an operation which caused the children to have sequential sorting numbers. I'm working on a fix for that - just wanted to let you know that it happens when you trigger one of these actions ;) So I think our solution to this should be a lot smaller than this suggested patch. Our goal: get the right colPos value transferred, extend the hook that catches the localisation action and perform selective localisation on whichever children are resolved based on session-stored target info array identified by colPos value. Hope this makes sense! |
The main problem is, that the TYPO3 core fetches in Localization.js the content elements which should translated via ajax. The core AjaxRoutes are languages_page_colpos, records_localize_summary and records_localize. There is no hook to extend the associated methods in flux_languages_page_colpos -> get available languages of the flux:grid column (step 2 of 4 in the localization process) Without these own LocalizationController and Repository we have no chance. |
As far as I can tell, these all call LocalizationController which delegates the resolving of records to LocalizationRepository. The one exception is the "perform localization" method which generates the command map, but for that one the following should be true:
This means that assuming we fix the resolving of colPos value, the controller will receive the right value and pass it to the LocalizationRepository. Which should mean we need two concrete things:
Sadly, 2. requires different implementations for LTS and 8.x (with Doctrine) but there's nothing to do about that. If we can limit the scope of this change to those two things I would have no objections to it. I will then follow that up with a FEATURE request for the TYPO3 core to add signals which manipulate the Doctrine query before it gets dispatched, and hope to get that in TYPO3v9 so we can use that instead of our overrides some day. |
Correction: we may not need two different overrides of LocalizationRepository. Assuming the method signatures are the same, we can simply catch our colPos-higher-than-FLUX_COLPOS_CONTENT case and do our special queries, and if colPos is lower, call method on parent. |
That's sound good. I'll try it and build a version with colPos-higher-than-FLUX_COLPOS_CONTENT. |
a8ea958
to
ed3b93a
Compare
@NamelessCoder Hi Claus, the usage with colPos-higher-than-FLUX_COLPOS_CONTENT works great for an adjusted
I think there are some bugs in the TYPO3 localization: Here are some important informations for TYPO3v8.6+ |
119e763
to
2939387
Compare
I pushed a new version which also has been tested in TYPO3 7.6. |
Correct handling of localized elemnts in flux grid columns
Hi, i`ve tested this commit on master. Translation is working fine now (finally, thanks!!!!). But there are some hiccups, for example the translation window is not closing. I`d like to see this bugfix merged and published to the TER, even if its not the cleanest solution. Is there anything i can do to help? More testing? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't forgotten, but because of the amount of overrides this would require, I decided to look for another possibility. So I've asked if it would be possible to add signals in TYPO3 itself in the places where we currently require class overrides - and I've asked if those could be included in TYPO3 LTS which we will require for Flux soon after it is released.
Will update when I have more to tell. With a bit of luck the suggested signals will be approved and we can avoid all overrides this PR requires. If that can't happen I'll reconsider these overrides.
Are there any news on this one? Thanks for all your work! |
Hey, have you found another possibility for this issue? Thanks! |
@Kleisli @michael-binder Sorry guys - no. The overrides required by this pull request are still too extensive to include and maintain, and the core still does not allow the right integrations to work with this particular translation action. The best best for now seems to be either translating via the IRRE relation that's in the parent element, or using an assistant extension like |
PR #1545 sould solve this too. |
Solved as part of #1563 - thanks for your work all the same! |
FluidTYPO3\Flux\Backend\Controller\LocalizationController
\TYPO3\CMS\Backend\Controller\Page\LocalizationController
AjaxRoutes to \TYPO3\CMS\Backend\Controller\Page\LocalizationController
flux_languages_page_colpos
-> get available languages of the flux:grid column (step 2 of 4 in the localization process)flux_records_localize_summary
-> get the uid, icon and title off all elements which would localized ( step 3 of 4 in the localization process)flux_records_localize
-> build the cmdMap with the elements uids and own commands and additional flux specific dataFluidTYPO3\Flux\Backend\Preview
Localization.js
is adjusted to work with flux:gridFluidTYPO3\Flux\Backend\TceMain
processCmdMap
to handle the localization for flux:grid elementsprocessCmdmap_postProcess to add Data in
$pasteDataMap`\TYPO3\CMS\Backend\Domain\Repository\LocalizationRepository
tx_flux_colum
andtx_flux_parent
\TYPO3\CMS\View\PreviewView
resolves #1120