11.1.2 言語切り替え対応ポートレットの開発例

使用する言語を判定するJSPファイルのサンプルコードを次に示します。

サンプルコード

<%@ page contentType="text/html; charset=Shift_JIS" %>
<%@ page import="jp.co.hitachi.soft.portal.portlet.beans.PortletInfoBean" %>
<%@ page import="jp.co.hitachi.soft.portal.api.user.LocaleData" %>
<jsp:useBean id="configbean" class="jp.co.hitachi.soft.portal.portlet.beans.PortletInfoBean" scope="page"/>

<%
configbean.initBean(request);

String langType = LocaleData.getLangType(request) ;

if(langType.equals("ja"))
 configbean.setCustomizeTitle("日本語用のタイトルメニューです") ;
else if(langType.equals("en"))
 configbean.setCustomizeTitle("For English Title Menu") ;
else
 configbean.setCustomizeTitle("Other Language Title Menu") ;

%>
サンプルポートレット