Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-296

Incorrect handling of three-letter IANA language locales

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • 2.2.6
    • None
    • None

      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

        Acceptance criteria

              Unassigned Unassigned
              mdrapela Martin Drápela
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD