Use JSTL tags in the portal JSPs
WebSphere Portal supports the use of JSTL and Jakarta tags.
Portal themes, skins, and screens can retrieve translated text by using the I18N tags from the JSP Standard Tag Library (JSTL). The I18N tag library is a subset of JSTL for handling issues of internationalization and translation. This method is preferred over using the <wps:text/> tag from the engine tag library. You can find information about the I18N tag library of the JSTL at
http://jakarta.apache.org/taglibs/doc/i18n-doc/intro.html.
The following tags from the I18N tag library are used to retrieve translated text:
- <i18n:bundle/> - specifies the resource bundle for use by the other I18N tags.
- <i18n:message/> - specifies the key to retrieve from the bundle and writes the value to output.
When these I18N tags are used, the underlying getLocales() method of the HTTPServletRequest is overwritten to return the language preference in the user profile, if available. See Language determined by the portal for a complete description of how the language is selected. For more information about these tags, see the I18N Tag Summary at http://jakarta.apache.org/taglibs/doc/i18n-doc/index.html#summary .
Set up the portal to support I18N tags from JSTL
This one-time procedure allows your portal to support I18N JSTL tags in themes, skins, and screens.
- Download the I18N tag library from the Jakarta Web site at the following address:
http://cvs.apache.org/builds/jakarta-taglibs/nightly/projects/i18n/
- Extract taglibs-i18n.jar to the location of the portal server WPSLib shared library (wp_root/shared/app).
- Extract taglibs-i18n.tld to the location of the portal server tag definition declarations (wp_root/shared/app/WEB-INF/tld).
- From the WebSphere Application Server Administrative Console, update the application server class path with the name and location of the new JAR. Click Environment Shared Libraries WPSlib.
- Restart the portal server.
JSPs in the portal can now use the I18N JSP tags for retrieving translated text from resource bundles.
Use I18N tags in place of the engine text tag
The following steps show how to change the portal help icon to text using the I18N tags. Make sure that you have performed the setup steps.
- Make a backup copy of ToolBarInclude.jsp in the /themes directory.
- Edit ToolBarInclude.jsp.
- Find the markup for the help icon:
<%-- help button --%> <td class="wpsToolBarIcon" valign="middle" align="<%=bidiAlignRight%>" nowrap> <a class="wpsToolBarLink" href='<%= wpsDocURL %>/InfoCenter/help/index.html' target=" ... <img border="0" align="absmiddle" width="16" height="16" src='<wps:urlFindInTheme ... </a> </td>- Replace the image tag with the following markup shown in bold.
<%-- help button --%> <td class="wpsToolBar" valign="middle" align="<%=bidiAlignRight%>" nowrap="nowrap"> <a class="wpsToolBarLink" href='<%= wpsDocURL %>/InfoCenter/help/index.html' target="... <i18n:bundle baseName="nls.engine"> <i18n:message key="link.help"/> </i18n:bundle> </a> </td>- Add the following directive near the top of Default.jsp
<%@ taglib uri="/WEB-INF/tld/taglibs-i18n.tld" prefix="i18n" %>
Test this procedure by changing your language preference in the portal user profile and logging back in to the portal.
See also