[MGNLREST-296] Incorrect handling of three-letter IANA language locales Created: 10/Feb/21  Updated: 25/Mar/22

Status: Accepted
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: 2.2.6
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Martin Drápela Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2021-02-11-10-02-30-445.png    
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:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Date of First Response:

 Description   

Steps to reproduce

  1.  Add to the travel site's i18n for example the  szl locale (for "Silesian", https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry). Just the lang locale, not any country. 
  2. In page editor, edit page name (via page properties)  of /travel/book-tour/meal. In the language switcher, choose Silesian, and rename the page to "Krutipysk" .
  3. Retrieve the page's parent via REST, will pose two problems:
    Endpoint config:
class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
workspace: website
bypassWorkspaceAcls: true
rootPath: /travel/book-tour/
nodeTypes:
 - mgnl:page

Result returned - the (three-letter?) locale "is not allowed": 

{
    "error": {
        "code": "badRequest",
        "message": "Language parameter: szl is not allowed"
    }
}

Expected (part) is:

{
"@name": "meal",
"@path": "/travel/book-tour/meal",
"@id": "9b8ea1b2-a93f-4015-a822-84d730ca982a",
"@nodeType": "mgnl:page",
"hideInNav": "true",
"title": "Krutipysk",
"@nodes":[]
}

Result returned - notice that it includes also the szl variant: 

{
"@name": "meal",
"@path": "/travel/book-tour/meal",
"@id": "9b8ea1b2-a93f-4015-a822-84d730ca982a",
"@nodeType": "mgnl:page",
"hideInNav": "true",
"title": "Menü",
"title_szl": "Krutipysk",
"@nodes":[]
}

Expected (part) is:

{
"@name": "meal",
"@path": "/travel/book-tour/meal",
"@id": "9b8ea1b2-a93f-4015-a822-84d730ca982a",
"@nodeType": "mgnl:page",
"hideInNav": "true",
"title": "Menü",
"@nodes":[]
}

Possible impact of the issue

May affect for example the speakers of Chinese who would like to configure in a specific variant rather then the zh macrolanguage locale:
cmn - "... Mandarin is often placed first in lists of languages by number of native speakers (with nearly a billion). Mandarin is by far the largest of the seven or ten Chinese dialect groups, spoken by 70 percent of all Chinese speakers over a large geographical area ..."

Note: The IANA subtag registry lists:

  • 8326 three-letter lang subtags
  • 190 two-letter lang subags


 Comments   
Comment by Christopher Zimmermann [ 16/Feb/22 ]

jsimak do you think this problem might been improved at all with latest fix with country codes - welsh thing?

Comment by Jaroslav Simak [ 16/Feb/22 ]

czimmermann I don't know, this needs to be verified.

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