[EXCONTRANS-353] Translation of custom content app is not working Created: 27/Oct/21  Updated: 11/Jan/22  Resolved: 11/Jan/22

Status: Resolved
Project: Content Translation Extended (CTX)
Component/s: None
Affects Version/s: 3.4
Fix Version/s: 3.4.2

Type: Bug Priority: High
Reporter: Tobias Kerschbaum Assignee: Teresa Miyar
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Magnolia 6.2.12


Attachments: PNG File TranslationExtendedDebugScreenshot-1.png     PNG File TranslationExtendedDebugScreenshot.png     File inspiration.yaml     File inspirations-app.yaml     File inspirations.yaml    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Context

I am just testing the Translation Module extended (deeple) with a custom content app. 
First I had to fix one thing in the Implementation to get it work at all. This line here has to be changed to:

if (file.isFile() && FilenameUtils.removeExtension(file.getName()).equals(appName)) {

Otherwise, it will not work because the App name will not be inspirations-app.yaml 
But beside of that, I gave it a try, and it worked. But not 100% perfect  The Translation is working until the point of the import. I get all Fields translated in the Review of the task, I can also see the translations. Also in the queues section I see all of them. But in the actual import Command I only get 3 of the Fields. The translation of the subModels productCard are missing.

Steps to reproduce

  1. Create the content app (app: inspirations-app.yaml| contentType: inspiration.yaml)
  2. Create some content (demo content is attached: inspirations.yaml)
  3. Create a translation Batch
  4. Submit the batch
  5. Import the translations

Expected results

All Fields should be translated.

Actual results

Only the Fields Title, Text and searchText are translated

Workaround

Development notes

Like mentioned above, the Problem can be debugged at this line.

You can see the bundleReader has only 3 updated bundles:

I also produced a Video to show the behavior:
https://drive.google.com/file/d/1r7slShkaEUHEBo8qeV1vwLa0GLt_iE-F/view?usp=sharing



 Comments   
Comment by Riste Drangovski [ 02/Nov/21 ]

This issue is happening mainly because of inconsistency in how fields are handled in content apps.

When working with complex fields like: switchable, composite and multi how data is saved in the JCR tree structure is defined from three parameters:

  • field type
  • itemProvider
  • propertyNameDecorator (in entryResolution for Multifield)

These parameters define if data will be saved in the current jcr node or for example child jcr node, name of the child node or name of the property where data will be saved, etc…

When we don’t set explicit values for these properties magnolia should load default values. Problem is that default values for the fields defined in the content app are not the same as the fields defined in magnolia dialogs.

So for the example inspirations content-app that is attached, this definition:

productLines:

  field:

    properties:

      productCards:

        field:

          properties:

            text:

              rows: 5

              i18n: true

            product:

 

needs to be changed to:

productLines:

  entryResolution:

    propertyNameDecorator: info.magnolia.ui.field.NoopNameDecorator

  field:

    itemProvider:

      $type: currentItemProvider

    properties:

      productCards:

        entryResolution:

          propertyNameDecorator: info.magnolia.ui.field.NoopNameDecorator

        field:

          itemProvider:

            $type: currentItemProvider

          properties:

            text:

              $type: textField

              rows: 5

              i18n: true

            product:

              $type: textField

There is also need for improving how this values are handled in:

info.magnolia.translation.finder.AbstractPropertiesToTranslateFinder#resolvePropertiesToTranslate

https://git.magnolia-cms.com/projects/ENTERPRISE/repos/content-translation-support/browse/magnolia-content-translation/src/main/java/info/magnolia/translation/finder/AbstractPropertiesToTranslateFinder.java#78

For example for multifield entryResolution (and automatically propertyNameDecorator) is not handled in any way. Also we need to cover multiple cases for propertyNameDecorator not just PrefixNameDecorator…

Comment by Riste Drangovski [ 20/Dec/21 ]

Magnolia does not handle propertyNameDecorator of entryResolution property.
Magnolia is always using info.magnolia.ui.field.NoopNameDecorator for multi field.

Comment by Teresa Miyar [ 21/Dec/21 ]

From PD:
The jcrMultiField which generated from content type, it has propertyNameDecorator set to AlwaysEmptyPrefixNameDecorator , so the data will be /productLines/0/productCards/0/text IIRC, does not use this propertyNameDecorator, it used default info.magnolia.ui.field.NoopNameDecorator so you will see other data structure /productLines/productLines0/productCards/productCards0/text.So, if you want  jcr from app-from-content type work the same to dialog, you can decorate `propertyNameDecorator`

We will add some documentation to address this.

Generated at Mon Feb 12 00:30:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.