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

LanguageFilter doesn't replace in JS Liferay.Language.get() with guest locale for guests only

    Details

      Description

      When guest language is set different from English everything is translated fine except JS files having Liferay.Language.get(key) inside.
      When user with non-English locale is logged in – all js translations work fine.

      Debugging shows that LanguageFilter tries to extract Locale from HTTP session however at some point new session is created for guest (phishing protection?) and this causes the LanguageFilter to fail to extract locale from session thus using English locale by default.

      Temporarily workaround we found:
      When main.js is being loaded it has a few parameters that come with the get request.
      One of these parameters is "languageId".
      When loading other scripts from main.js you can add this parameter in order to make sure LanguageFilter translates the keys correctly.
      For example:
      my-theme/js/commons.js?languageId=it_IT
      This workaround is far from being perfect though. I'd prefer a solution which is based directly on the default user (portal) locale

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michael.saechang Michael Saechang
              Reporter:
              leonf@dpolls.com Leon
              Participants of an Issue:
              Recent user:
              Esther Sanz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                8 years, 19 weeks, 6 days ago

                  Packages

                  Version Package
                  7.0.0 M6