12.8 Sample scenario: NLS bundles

In this sample scenario, NLS bundles will be created to support multiple languages. Once you have done this using RAD, the JSP that delivers markup content in View mode for portlet MessageReceiverPortlet will be enhanced to access the NLS bundles.

The Portlet Messaging application sample scenario from Chapter 7, Portlet messaging will be used as a base application to add NLS support. The scenario is illustrated in Figure 12-18.

Figure 12-18 National Language Support (NLS) scenario

The resource bundle is accessed via the PortletContext object's getText method and you will need to provide the following:

Bundle Base Name: the first parameter indicates the base name of the resource bundle. The name includes the path relative to the classes directory. The name does not specify the locale suffix or the properties file type. If the base file name cannot be found, or the key is not present in the properties file, a PortletException is thrown.

Key: this parameter maps to a key value in the properties file. If the key is not found, a PortletException is thrown.

In addition, the locale is used by the Portal to select the proper language bundle. However, you cannot set this value when invoking NLS bundles from JSPs.


Redbooks
ibm.com/redbooks