[MGNLUI-7415] Switchable field with i18n settings ignores other locales selections Created: 04/Aug/22  Updated: 27/Nov/22  Resolved: 09/Sep/22

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.22
Fix Version/s: 6.3, 6.2.24

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Sang Ngo Huu
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 3d Time Spent: 0.75d
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Problem/Incident
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLUI-7468 Implement Sub-task Completed Sang Ngo Huu  
MGNLUI-7469 Review Sub-task Completed Adam Siska  
MGNLUI-7470 Pre-int QA Sub-task Completed Adam Siska  
MGNLUI-7471 QA Sub-task Completed Jaromir Sarf  
MGNLUI-7514 Add document PR Sub-task Completed Sang Ngo Huu  
MGNLUI-7515 Port to 6.3 Sub-task Completed Sang Ngo Huu  
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
Date of First Response:
Epic Link: Nucleus Quality Maintenance
Sprint: Nucleus 18
Story Points: 3
Team: Nucleus

 Description   

Steps to reproduce

  1. Create a component with the following dialog:
    my-component.yaml
     form:
      properties:
        switchable:
          $type: switchableField
          i18n: true
          field:
            $type: radioButtonGroupField
            layout: horizontal
            name: switchable
            datasource:
              $type: optionListDatasource
              options:
                - name: foo
                  value: foo
                - name: bar
                  value: bar
          itemProvider:
            $type: currentItemProvider
          forms:
            - name: foo
              properties:
                foo:
                  $type: textField
            - name: bar
              properties:
                bar:
                  $type: richTextField 
  2. Create the component on a page and select foo for english (set a value on the textField) and bar for other language (set a value on the richText)
  3. Save the component
  4. Open the component
  5. Check that for fallback locale, the foo value is properly selected
  6. Switch to other language and check that the foo value remains selected instead of switching to bar

Expected results

The selected value and input for each language is properly selected

Actual results

The fallback option remains selected

Workaround

N/A

Development notes

The data is properly stored at JCR, looks like only the selection is wrong



 Comments   
Comment by Adam Siska [ 22/Aug/22 ]

Please try to set

i18n: true

 

also for inner radioButtonGroupField. With this both switchable and switchable_de properties are persisted and looks like it is working accordingly..

Comment by Adam Siska [ 22/Aug/22 ]
form:
  properties:
    switchable:
      $type: switchableField
      i18n: true
      field:
        $type: radioButtonGroupField
        layout: horizontal
        i18n: true
        name: switchable
        datasource:
          $type: optionListDatasource
          options:
            - name: foo
              value: foo
            - name: bar
              value: bar
      itemProvider:
        $type: currentItemProvider
      forms:
        - name: foo
          properties:
            foo:
              $type: textField
              i18n: true
        - name: bar
          properties:
            bar:
              $type: richTextField 
              i18n: true 

with this definition all data for both languages are stored/used separately.. anyway it is true, that i18n settings in this case are a bit clumsy.. maybe we might want some default propagation of the i18n flag from parent (switchable) field level.

Comment by Adam Siska [ 22/Aug/22 ]

Discovery:

Comment by Roman Kovařík [ 22/Aug/22 ]

Suggestion:
Introduce ConfiguredSwitchableFieldDefinition#init method which allows only an identical value of the i18n property in ConfiguredSwitchableFieldDefinition#18n and its innerField#i18n (reports a def. app error and fixes the config).

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