[MGNLCTS-126] Support for complex fields Created: 11/Jan/21  Updated: 22/Sep/21  Resolved: 04/Feb/21

Status: Closed
Project: Content Translation Support
Component/s: None
Affects Version/s: 2.5
Fix Version/s: 2.5.1

Type: Bug Priority: Major
Reporter: Teresa Miyar Assignee: Federico Grilli
Resolution: Fixed Votes: 5
Labels: cs-bk, maintenance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2021-02-04 at 15.53.32.png     File hero-1.yaml     File hero.yaml     JPEG File multivalue_1.jpg     JPEG File multivalue_2.jpg    
Issue Links:
Relates
relation
is related to MGNLCTS-109 No export of MultiValueFields Open
is related to MGNLCTS-93 Nested composite fields are not exported Closed
is related to MGNLCTS-130 Partial export of jcrMultiField with ... Closed
is related to MGNLCTS-127 Support for source language selection Closed
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
Release notes required:
Yes
Date of First Response:
Sprint: Maintenance 42, Maintenance 43
Story Points: 2

 Description   

Add support for complex fields export/import, composite, switchable and multivalue

For more information check: https://wiki.magnolia-cms.com/pages/viewpage.action?spaceKey=~tmiyar&title=Content+Translation+Support+Improvements



 Comments   
Comment by Riste Drangovski [ 11/Jan/21 ]

PR: https://git.magnolia-cms.com/projects/ENTERPRISE/repos/content-translation-support/pull-requests/38/overview

Comment by Riste Drangovski [ 25/Jan/21 ]

How to test

Issue:
When using complex fields (switchable, multifield, composite) although fields are marked as translateable i18n=true fields are not getting exported.

Steps to test:

  • create new page template
  • create component with dialog that contains complex fileds (and nested) fields, for example: switchable field with multifield, composite field with multifield, switchable field with composite etc ...
  • mark all field in the dialog with i18n: true
  • create a page from the new template and fill all fields for the components
  • go to content translation app
  • choose the new page that you have created
  • export translation
  • doesn't mather which type of file you choose in the "export translation file" dialog
  • translation file should contain entries for all the complex fileds that were defined in the component dialog
  • aftere adding translation for ths fields in the translation file and importing this file we need to check that translations are properly imported for all fields.

 

note: we also need to check complex fields in combination of itemProvider and nameDecorator properties.

Comment by Riste Drangovski [ 29/Jan/21 ]

mdrapela Could you please add the following to the Release Notes?

It was necessary to break binary compatibility at
info.magnolia.translation.io.ExportVisitor#buildTranslationBundle
because of support for multi fields. We had to change method signature  

from: 
TranslationItem buildTranslationBundle(final Node parentNode, final PropertyToTranslate propertyToTranslate) throws RepositoryException
to:
List<TranslationItem> buildTranslationBundle(final Node parentNode, final PropertyToTranslate propertyToTranslate) throws RepositoryException

this is needed because for one multi field we can get multiple translation items.

Comment by Tomáš Gregovský [ 04/Feb/21 ]

hero.yaml
we have this definition for hero dialog, when testing 'heroCtas' which is $type: jcrMultiField with subfields $type: compositeField and when having 3 objects there, they are saved as a nodes with names:

  • heroCtas0
  • heroCtas1
  • heroCtas2
    But in generated translation export there are only 2:
  • 618becb4-cde0-4eaa-8da8-e2cb127c238b:heroCtas/heroCtas1/linkLabel.i18n.
  • 618becb4-cde0-4eaa-8da8-e2cb127c238b:heroCtas/heroCtas2/linkLabel.i18n.


Comment by Riste Drangovski [ 04/Feb/21 ]

As far as I can see the issue is related with the itemProvider configuration.
In the configuration for multifield we are using jcrChildNodeProvider and also for the composite field we are using jcrChildNodeProvider.

I short:
if you remove itemProvider configuration from composite field, translation should work properly.

A bit longer:
As far as I understand because we are setting jcrChildNodeProvider for the composite field, composite field should create a node (based on it's name) in which it will store the properties.
But this is not happening. It doesn't matter if we use jcrChildNodeProvider for the composite field or not, in both cases we are getting same data structure in the JCR.

Please check screenshots and attached yaml configuration ...

I'm not sure that this is translation related issue, pls let me know if we should do anything about this.

Comment by Federico Grilli [ 04/Feb/21 ]

rdrangovski indeed removing itemProvider configuration from composite field seems to do the trick. We could create a follow-up issue to investigate this further in order not to delay 2.5.1 release. tgregovsky WDYT?

Comment by Tomáš Gregovský [ 05/Feb/21 ]

hi rdrangovski and fgrilli, yes removing item provider from composite field helps, so this is fine for our project.

would would agree on follow up ticket, since using itemProvider for composite field is documentation https://docs.magnolia-cms.com/product-docs/Templating/Dialog-definition/Field-definition/List-of-fields/Composite-field.html

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