Skip to content
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

Inline content elements seems not to be respecting the localization #188

Closed
AnuBN opened this issue Aug 25, 2021 · 2 comments · Fixed by web-vision/wv_deepltranslate#37
Closed

Comments

@AnuBN
Copy link

AnuBN commented Aug 25, 2021

Environment

TYPO3 : v10.4.19
Container : v1.3.1

Workaround

We have a custom extension where we process the content elements which are translated. Inorder to do so we extended the LocalizationController to add data into the cmdmap and later processing within processTranslateTo_copyAction hook.

The process() method in LocalizationController was expected to receive an array of content elements that are intended to translate. But seems the method is not receiving the inline content elements.

Is that supposed to do so or do we have an option to make inline content elements respect the localization? Because the readme suggests so.

When translating a container, all child elements get also translated (the child elements are not explicit listed during the translation dialog)

@achimfritz
Copy link
Contributor

@AnuBN

Boris Hinzer reports at slack that this behaviour occurs with the EXT:wv_deepltranslate.

the EXT:container do localization of child-Records in two ways:

  1. having a non-translated container (with children): translate also children with B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook->localizeOrCopyToLanguage (children are not listed in Localization-Modal because they have a colPos unknown for PageLayout/Backend_Layout)
  2. having a new child-element in a container in default language, where the container is already translated. start the translation : the new content appears in the Localization-Model due the XClass B13\Container\Xclasses\LocalizationController

There are two Problems having EXT:container and EXT:wv_deepltranslate together:
1.Both Extensions xclasses \TYPO3\CMS\Backend\Controller\Page\LocalizationController (so the order of Extension-Installation "wins")
2. the B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook->localizeOrCopyToLanguage do not know $cmdmap['localization']['custom']['mode'] (is this extension-custom? or is this supported by core, i have never heart about this?)

a solution could be (i have tested this, and then everythings works fine):

  1. use a "combined" XClass for the \TYPO3\CMS\Backend\Controller\Page\LocalizationController (i think this should be done in EXT:wv_deepltranslate with a condition in the ext_localconf.php checking the EXT:container is installed)
    2.1 if $cmdmap['localization']['custom']['mode'] is supported by core (is it or not?) i will adapt the B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook->localizeOrCopyToLanguage method to pass the mode to the $cmdmap translating the children
    2.2 if $cmdmap['localization']['custom']['mode'] is custom of extension, the EXT:wv_deepltranslate should care (by xclassing B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook
    The Patch for this will look like:
@@ -65,6 +66,9 @@ class CommandMapPostProcessingHook
             $container = $this->containerFactory->buildContainer($uid);
             $children = $container->getChildRecords();
             $cmd = ['tt_content' => []];
+            if (!empty($dataHandler->cmdmap['localization'])) {
+                $cmd['localization'] = $dataHandler->cmdmap['localization'];
+            }
             foreach ($children as $colPos => $record) {
                 $cmd['tt_content'][$record['uid']] = [$command => $language];
             }

NairCoder added a commit to web-vision/wv_deepltranslate that referenced this issue Sep 20, 2021
NairCoder added a commit to web-vision/wv_deepltranslate that referenced this issue Sep 20, 2021
@NairCoder
Copy link

NairCoder commented Sep 20, 2021

Thank you very much @achimfritz for your reference over the issue. Since the localization/custom/mode is a custom addition in the extension, we proceeded with the way you suggested by hooking into the container if the ext is installed.
wv_deepltranslate/#2debcce
This issue can be closed now. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants