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

              michael.saechang Michael Saechang
              tibor.lipusz Tibor Lipusz
              Rafaela Nascimento Rafaela Nascimento
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                10 years, 32 weeks ago

                Packages

                  Version Package
                  6.2.0 CE M2