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

Use RenderRequest locale to get the portlet title

    Details

      Description

      LPS-28904 introduced support of title and description translation for multi-portlet plugins on trunk. It could seem at first sight that this LPS solved the page title problem on trunk, but it doesn't work properly:

      PortalImpl.java
      // ...
      public String getPortletTitle(RenderRequest renderRequest) {
      		String portletId = (String)renderRequest.getAttribute(
      			WebKeys.PORTLET_ID);
      
      		Portlet portlet = PortletLocalServiceUtil.getPortletById(portletId);
      
      		HttpServletRequest request = PortalUtil.getHttpServletRequest(
      			renderRequest);
      
      		ServletContext servletContext = (ServletContext)request.getAttribute(
      			WebKeys.CTX);
      
      		Locale locale = request.getLocale();
      
      		return getPortletTitle(portlet, servletContext, locale);
      	}
      // ...
      

      >>> During the creation of HttpServletRequest the original locale of RenderRequest (e.g. fr_FR) is being lost, and the new request will have different locale.
      More precisely: The locale of the newly created HttpServletRequest will be equal to the value of the renderRequest's "Accept-Language" header, which is equal to the given browser's locale, regardless of the set portal displayLocale or portal defaultLocale.

      Changing the portal's default locale doesn't solve the problem.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michael.saechang Michael Saechang
              Reporter:
              tibor.lipusz Tibor Lipusz
              Participants of an Issue:
              Recent user:
              Esther Sanz
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                9 years, 45 weeks, 1 day ago

                  Packages

                  Version Package
                  6.2.0 CE M2