Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-77681

Site default locale not being used as default language

    Details

      Description

      When setting the property locale.prepend.friendly.url.style=2, the determination of which locale is shortened is based off the portal settings, not site settings.

      With this property, Liferay forces the locale/language code into the URL on each page.  So, for example, for the default page "localhost:8080/web/guest", if we have English as the default portal language, the URL would change to "localhost:8080/en/web/guest".  However, when dealing with multiple locales belonging to the same language (like English for USA, Great Britain, or Australia), we must include the locale code for each duplicate language aside from the first.  So, if I have en_US, en_GB, and en_AU in that order, en_US will be shortened to en, and the other two lang/locales will be the full code.

      The issue occurs when we try to change the site language settings.  In the above example, if my site settings are en_GB, en_AU, and en_US in that order, en_GB should be shortened to en, but we use the portal settings, so en_US is still shortened.

      Further, if we have a site with only en_AU, we will not shorten it to en since en_US is the portal default.

      Steps to reproduce:

      1. Begin by setting the following properties: 
        1. locale.prepend.friendly.url.style=2
        2. locales.enabled=en_US,en_GB,en_AU,es_ES
      2. Start the portal and verify this is the order the languages appear (Note, in master, we always return an arbitrarily ordered list of languages.  So regardless of what order we save in, we are displayed with the same order, however the order is saved under the hood.  This is likely unfixable  due to the use of a ConcurrentHashMap to store languages to make them thread-safe.  This is visible in 62x though.)
      3. Create three sites, one with default language ordering, the other with Great Britain set as the default language, the last with Spanish as the default language and the order as follows: es_ES, en_AU, en_US, en_GB
      4. For each site, create a page with translations for each language.  Name each page translation after the locale for easy recognition.
      5. For each page, add a Language portlet for easy navigation
      6. Click on each locale and attempt to go to "localhost:8080/en/web/siteName" for each site

      Expected results:

      1. default site:
        1. en_US -> en
        2. en_GB -> en_GB
        3. en_AU -> en_AU
        4. es_ES -> es
        5. localhost:8080/en -> USA locale
      2. Great Britain site:
        1. en_US -> en_US
        2. en_GB -> en
        3. en_AU -> en_AU
        4. es_ES -> es
        5. localhost:8080/en -> Great Britain locale
      3. Site 3:
        1. en_US -> en_US
        2. en_GB -> en_GB
        3. en_AU -> en
        4. es_ES -> es
        5. localhost:8080/en -> Australia locale

      Actual results:

      1. default site
        1. en_US -> en
        2. en_GB -> en_GB
        3. en_AU -> en_AU
        4. es_ES -> es
        5. localhost:8080/en -> USA locale
      2. Great Britain site:
        1. en_US -> en
        2. en_GB -> en_GB
        3. en_AU -> en_AU
        4. es_ES -> es
        5. localhost:8080/en -> USA locale
      3. Site 3:
        1. en_US -> en
        2. en_GB -> en_GB
        3. en_AU -> en_AU
        4. es_ES -> es
        5. localhost:8080/en -> USA locale

      Reproduced in Master: eabcdfb714fb62

      Reproduced in 70x

      Reproduced in 62x

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 20 weeks, 1 day ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 DXP FP60
                  7.0.0 DXP SP9
                  7.0.X
                  7.1.0 M2
                  7.1.X
                  Master