[PAGES-895] Languages with country codes are not rendering in edit mode Created: 13/Oct/22  Updated: 06/Apr/23  Resolved: 04/Apr/23

Status: Closed
Project: Magnolia pages module
Component/s: SPA Renderer
Affects Version/s: 6.2.23
Fix Version/s: 6.3.0, 6.2.27

Type: Bug Priority: Neutral
Reporter: Richard Gange Assignee: Chuong Doan Huy
Resolution: Fixed Votes: 4
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 0.5d Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
relation
Sub-Tasks:
Key
Summary
Type
Status
Assignee
PAGES-1118 Implement Sub-task Completed  
PAGES-1119 Review code Sub-task Completed Chuong Doan Huy  
PAGES-1120 Pre-int QA Sub-task Completed Robert Šiška  
PAGES-1121 Final QA Sub-task Closed Oanh Thai Hoang  
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: Support
Sprint: DevX 34
Story Points: 1
Team: DeveloperX
Work Started:
Approved:
Yes

 Description   

Reproduce

  1. Setup SPA Demo locally
  2. In the site configuration have two variations of english: en, en_GB
    'travel':
      'i18n':
        'class': 'info.magnolia.cms.i18n.DefaultI18nContentSupport'
        'enabled': true
        'fallbackLocale': 'en'
        'locales':
          'en':
            'country': ''
            'enabled': true
            'language': 'en'
          'de':
            'country': ''
            'enabled': true
            'language': 'de'
          'en_GB':
            'country': 'GB'
            'enabled': true
            'language': 'en'
    
  3. In the pages detail subapp try and switch between the two english options.

Expected
When selecting en_GB the values for that language should be displayed in the editor.

Actual
Selecting en_GB displays en. The pages app is not able to correctly display languages which also contain a country code.

Notes
The check for the default locale here in this class info.magnolia.pages.spa.routing.DefaultSpaRouter#getLanguage() only checks if the language is the same between the provided one and the site default, and ignores all other parts of the locale.
We have some code in the class AbstractI18nContentSupport which should help. In this class there is a method which is able to sort out "next best" but it this case it's a bit different because we want to find the most specific match.



 Comments   
Comment by Marvin Boie [ 10/Mar/23 ]

Hello,

I have opened a pull request for this issue: https://git.magnolia-cms.com/projects/MODULES/repos/pages/pull-requests/521/overview 

This was probably caused by https://jira.magnolia-cms.com/browse/PAGES-588 

Comment by Christopher Zimmermann [ 16/Mar/23 ]

Thank you mboie ! We'll take a look.

Generated at Mon Feb 12 06:23:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.