Foren

Localizing a portlet with multiple JSPs

Brandon Perdue, geändert vor 10 Jahren.

Localizing a portlet with multiple JSPs

New Member Beiträge: 2 Beitrittsdatum: 17.10.13 Neueste Beiträge
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.


&lt;%@include file="/resourcerequest/init.jsp" %&gt;
&lt;%@page import="java.util.Date" %&gt;
&lt;%@page import="java.util.List" %&gt;
&lt;%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %&gt;
&lt;%request.setCharacterEncoding("utf-8");%&gt;

&lt;%
	String dialogHeightStr = request.getParameter("dialogHeight");
    int dialogHeight = 0;
    if (dialogHeightStr != null &amp;&amp; !dialogHeightStr.isEmpty()) {
    	try {
        	dialogHeight = Integer.parseInt(dialogHeightStr);
        } catch (NumberFormatException e) {
            System.out.println("Could not parse height of dialog from '" + dialogHeightStr + "'");
        }
    } else {
        System.out.println("Height of dialog not specified");
    }
    int formDivHeight = 420;
    if (dialogHeight &lt; 600) {
    	formDivHeight = dialogHeight &gt; 280 ? dialogHeight - 180 : 100;
    }
%&gt;

<h2 align="center"><liferay-ui:message key="newResourceRequest" /></h2>
thumbnail
Andew Jardine, geändert vor 10 Jahren.

RE: Localizing a portlet with multiple JSPs

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
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, geändert vor 10 Jahren.

RE: Localizing a portlet with multiple JSPs

New Member Beiträge: 2 Beitrittsdatum: 17.10.13 Neueste Beiträge
Yes, the taglibs are included in an init.jsp. I have edited the original question to include a chunk of code.