Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Brandon Perdue
Localizing a portlet with multiple JSPs
November 8, 2013 11:35 AM
Answer

Brandon Perdue

Rank: New Member

Posts: 2

Join Date: October 17, 2013

Recent Posts

I am trying to localize a portlet to support both English and Korean. The portlet has several buttons that, when clicked, will pop up a dialog with a form for the user to fill out. Only the buttons are defined in view.jsp; each of the pop-up forms is defined in a .jsp of its own.

I've localized several portlets before, so I included all the usual includes and edits to support using <liferay-ui:message /> and Language.properties, and it works as expected for those strings that exist in view.jsp, but for the strings in all of the other .jsp files, they are not grabbing the keys from the resource bundles.

Is there something additional I must do to localize these additional .jsp files? The portlets I've worked with previously have defined everything within view.jsp itself.

Edit: Here is a little bit of the code in question, down to the first key that isn't being grabbed. The liferay-ui library include is contained in resourcerequest/init.jsp.

 1
 2<%@include file="/resourcerequest/init.jsp" %>
 3<%@page import="java.util.Date" %>
 4<%@page import="java.util.List" %>
 5<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
 6<%request.setCharacterEncoding("utf-8");%>
 7
 8<%
 9    String dialogHeightStr = request.getParameter("dialogHeight");
10    int dialogHeight = 0;
11    if (dialogHeightStr != null && !dialogHeightStr.isEmpty()) {
12        try {
13            dialogHeight = Integer.parseInt(dialogHeightStr);
14        } catch (NumberFormatException e) {
15            System.out.println("Could not parse height of dialog from '" + dialogHeightStr + "'");
16        }
17    } else {
18        System.out.println("Height of dialog not specified");
19    }
20    int formDivHeight = 420;
21    if (dialogHeight < 600) {
22        formDivHeight = dialogHeight > 280 ? dialogHeight - 180 : 100;
23    }
24%>
25
26<div id="dss_createResourceRequest_container" class="resourceRequest" style="position: relative">
27    <h2 align="center"><liferay-ui:message key="newResourceRequest" /></h2>
Andew Jardine
RE: Localizing a portlet with multiple JSPs
October 31, 2013 1:20 PM
Answer

Andew Jardine

Rank: Regular Member

Posts: 240

Join Date: December 22, 2010

Recent Posts

Are you defining the taglibs in an init.jsp and then including it in all JSPs? Can you share some of your code so we can see the structure?
Brandon Perdue
RE: Localizing a portlet with multiple JSPs
November 8, 2013 11:36 AM
Answer

Brandon Perdue

Rank: New Member

Posts: 2

Join Date: October 17, 2013

Recent Posts

Yes, the taglibs are included in an init.jsp. I have edited the original question to include a chunk of code.