[MGNLUI-3169] I18n'ize complex fields Created: 24/Sep/14  Updated: 29/Sep/22  Resolved: 30/Oct/14

Status: Closed
Project: Magnolia UI
Component/s: forms
Affects Version/s: None
Fix Version/s: 5.3.5

Type: Bug Priority: Major
Reporter: Zdenek Skodik Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: i18n, support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: XML File compositeDialog.mge.xml     XML File compositeDialog.xml    
Issue Links:
Relates
relates to MGNLUI-3469 AbstractCustomMultifield breaks the r... Closed
relates to MGNLUI-3610 Multivalue composite fields not suppo... Closed
relates to MGNLPN-196 Make use of new i18nized complex fiel... Closed
documentation
to be documented by DOCU-627 Improve Transformers documentation fo... 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:
Epic Link: I18n fields issues

 Description   

Using the attached dialog definition one can reproduce the following issues:

  • labels of the inner text fields are initially rendered without the language sign, only when one switches the language forth and back, they get rendered.
  • the filled-in values are lost when the language is switched forth and back.


 Comments   
Comment by Mikaël Geljić [ 30/Oct/14 ]

Here's a little recap on the few isolated issues involved here:

1. First I'd like to clarify the i18n setting for complex fields: setting i18n to true on a MultiField means that you want to store a whole different set of entries per locale. This may or may not be what you want. (same story for the CompositeField)
2. Complex fields' default transformers are known not to work with i18n. We might as well deprecate them.
For i18n, use the "delegating" transformers instead:

  • for CompositeField and SwitchableField:
    • info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
  • for MultiField:
    • info.magnolia.ui.form.field.transformer.multi.DelegatingMultiValueFieldTransformer
    • info.magnolia.ui.form.field.transformer.multi.DelegatingMultiValueSubnodeTransformer
      • newly introduced here, same storage strategy as non-i18n-friendly MultiValueSubChildrenNodePropertiesTransformer

3. The form would not show the language select, if no first-level field had i18n set to true (but only one "nested" TextField had). Now it looks up deeper to find potentially i18nized sub-fields.
4. MultiField and CompositeField were not locale-aware, thus new entries were never i18nized, hence the missing (en) suffixes. Now they are.
5. Finally, I did some cleanup to get rid of unused i18nContentSupport in these complex fields — which they shouldn't use anyway — I18nAuthoringSupport was rather used instead.

Also attached my resulting dialog definition (transformers, i18n=true only on one nested textfield).

Generated at Mon Feb 12 09:03:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.