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

Prepend URL Property Fails To Apply To All Applicable URLs

    Details

      Description

      Description:
      The client is experiencing an issue in which they do not see prepended locale on all necessary URLs when the following property is applied:

      locale.prepend.friendly.url.style=2

      The description of the property is as follows:

      #
      # Set this to 0 if the locale is not automatically prepended to a URL. This
      # means that each URL could potentially point to many different languages.
      # For example, the URL http://localhost:8080/web/guest/home could then be
      # viewed by users in many different languages.
      #
      # Set this to 1 if the locale is automatically prepended to a URL when the
      # requested locale is not the default locale. This means that each URL
      # points to just one language. For example, the URL
      # http://localhost:8080/web/guest/home would point to the default language.
      # The URL http://localhost:8080/zh/web/guest/home and
      # http://localhost:8080/zh_CN/web/guest/home would both point to the Chinese
      # language.
      #
      # In cases where the prepended locale is "zh" and not the complete locale
      # "zh_CN", then the full locale returned will be based on the order in which
      # the locales appear in the property "locales". If "zh_CN" appears before
      # "zh_TW", then "zh" will be a short hand for "zh_TW".
      #
      # The default language is set in system.properties with the properties
      # "user.country" and "user.language".
      #
      # Set this to 2 if the locale is automatically prepended to every URL. This
      # means that each URL points to just one language.
      #
      # Set this to 3 if the locale is automatically prepended to a URL when the
      # requested locale is not the default user locale. In the case of guest
      # users, the behavior is the same as having a value of 1.
      #
      # Note that each language requires an entry in the property "locales" and a
      # servlet mapping in web.xml for the I18n Servlet.
      #
      locale.prepend.friendly.url.style=3

      From this, the client believes that every URL should have the locale prepended to it. But, as you will see in the attached screenshot and steps to reproduce, some URLs are correctly prepended and some are not.

      Steps To Reproduce:

      1. Include the following properties in the portal-ext.properties file:
        locales=en_CA,fr_CA,de_DE,en_US
        locales.enabled=en_CA,fr_CA,de_DE,en_US
        locale.prepend.friendly.url.style=2
      1. Startup Liferay
      2. Create a new page
      3. Under the navigation menu, select "Configure Page" for the newly created page
      4. Map the languages to /french for fr_CA, /english for en_US, and /german for de_DE
      5. Sign Out
      6. Navigate to the newly created page and review the inspector output

      Expected Results:
      The inspector displays each link with its appropriate prepended URL for the language.

      Actual Results:
      The inspector displays some links with the appropriate prepended URL and others with no prepended URL. It looks something like the following:

      <link href="http://localhost:8080/english" rel="canonical">
      <link href="http://localhost:8080/en/english" hreflang="en-CA" rel="alternate">
      <link href="http://localhost:8080/fr/french" hreflang="fr-CA" rel="alternate">
      <link href="http://localhost:8080/de/german" hreflang="de-DE" rel="alternate">
      <link href="http://localhost:8080/english" hreflang="x-default" rel="alternate">
      <link href="http://localhost:8080/english" hreflang="en-US" rel="alternate">
      

      Branch:
      Reproducible In Branch

      commit dabfab5c6e80feab8e85bb1d07042a2acca3cfd9
      Author: Brian Chan <brian.chan@liferay.com>
      Date:   Sat Apr 29 12:35:24 2017 -0700

      The following displays:

      <link href="http://localhost:8080/english" rel="canonical">
      <link href="http://localhost:8080/en/english" hreflang="en-CA" rel="alternate">
      <link href="http://localhost:8080/fr/french" hreflang="fr-CA" rel="alternate">
      <link href="http://localhost:8080/de/german" hreflang="de-DE" rel="alternate">
      <link href="http://localhost:8080/english" hreflang="x-default" rel="alternate">
      <link href="http://localhost:8080/english" hreflang="en-US" rel="alternate">
      

      Master:
      Reproducible In Master

      commit 5d714eee20b88c5e0f8d22b0346557c0040ad1a6
      Author: shuyangzhou <shuyang.zhou@liferay.com>
      Date:   Mon May 1 11:10:01 2017 -0700

      The following displays:

      <link data-senna-track="temporary" href="http://localhost:8080/english" rel="canonical">
      <link data-senna-track="temporary" href="http://localhost:8080/fr/french" hreflang="fr-CA" rel="alternate">
      <link data-senna-track="temporary" href="http://localhost:8080/en/french" hreflang="en-CA" rel="alternate">
      <link data-senna-track="temporary" href="http://localhost:8080/english" hreflang="x-default" rel="alternate">
      <link data-senna-track="temporary" href="http://localhost:8080/en_US/french" hreflang="en-US" rel="alternate">
      <link data-senna-track="temporary" href="http://localhost:8080/de/french" hreflang="de-DE" rel="alternate">
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 50 weeks, 5 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 DXP FP20
                  7.0.3 CE GA4
                  7.0.0 DXP SP4
                  7.0.X EE
                  7.1.X
                  Master