[MGNLUI-6966] Saving JcrMultiField on locale containing "_" results in wrong naming of the JCR nodes Created: 01/Dec/21  Updated: 09/May/23  Resolved: 27/Mar/23

Status: Closed
Project: Magnolia UI
Component/s: dialogs, forms
Affects Version/s: 6.2.13
Fix Version/s: 6.3.0, 6.2.31

Type: Bug Priority: Major
Reporter: Roberto Gaona Assignee: Antonín Juran
Resolution: Fixed Votes: 2
Labels: VN-Analysis, VN-Testing
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 2.5d Time Spent: 2.5d
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: PNG File 2021-12-09 08_23_12-Site definitions _ Site _ LOCAL-JW.png     XML File config.modules.multisite.config.sites.travel.i18n.xml     PNG File image-2021-12-01-17-06-14-597.png    
Issue Links:
Problem/Incident
causality
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLUI-7941 Implementation Sub-task Completed Antonín Juran  
MGNLUI-7942 Code review Sub-task Completed Quach Hao Thien  
MGNLUI-7943 Pre-integration QA Sub-task Completed Quach Hao Thien  
MGNLUI-7944 Final QA Sub-task Completed Jaromir Sarf  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* 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:
Visible to:
Thomas Duffey
Epic Link: FieldsMaintenance
Sprint: Nucleus 32
Story Points: 3
Team: Nucleus
Work Started:

 Description   

Steps to reproduce

  1. Configure a dialog with a jcrMultiField property
  2. Configure multiple locales such as "en_GB" and "de_DE" (must have underscores)
  3. Save jcrMultiField entries on those locales.

Definition used for the jcrMultiField property:

  form:
    properties:
      randomText:
        $type: textField
        label: Random text here
      mediaList:
        $type: jcrMultiField
        i18n: true
        required: false
        field:
          name: mediaSwitchable
          $type: switchableField
          field:
            $type: radioButtonGroupField
            name: mediaSwitchable
            layout: horizontal
            defaultValue: image
            datasource:
              $type: optionListDatasource
              options:
                - name: image
                  label: global.label.image
                  value: image
                - name: video
                  label: Youtube
                  value: video
          itemProvider:
            $type: currentItemProvider
          forms:
            - name: image
              properties:
                image:
                  $type: damLinkField
                  required: true
            - name: video
              properties:
                video:
                  $type: compositeField
                  itemProvider:
                    $type: currentItemProvider
                  label: ""
                  properties:
                    youtubeId:
                      $type: textField
                      required: true
                      label: Youtube ID
                    placeholderImage:
                      $type: damLinkField
                      required: true
                      label: placeholderImage 

Find attached a i18n node configuration for the site: config.modules.multisite.config.sites.travel.i18n.xml

Expected results

Data is stored in JCR without issues, naming each locale nodes after their respective locale.

Actual results

Node's locale gets repeated and extended every time an edit is done on the item:

Workaround

Development notes



 Comments   
Comment by Roman Kovařík [ 01/Dec/21 ]

Where does that underscore come from, is it really added by the system or is it in an old content?
https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html

Comment by Jörg Wirsig [ 09/Dec/21 ]

It is generated by the system. 

Maybe because of the configuration in i18n

But i think it is a standard isn't it?

java.util.Locale#toString()

* Returns a string representation of this <code>Locale</code>
* object, consisting of language, country, variant, script,
* and extensions as below:
* <blockquote>
* language + "_" + country + "_" + (variant + "_#" | "#") + script + "_" + extensions
* </blockquote> 

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/LocaleUtils.html#toLocale-java.lang.String- also supports that notation.

Will this ticket be picked for upcoming release? And when is the next bugfix release plannend?

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