Internationalization
Portlets that support translation of the captions and descriptions associated with shared properties must provide resource bundles in the appropriate location in the WAR file. The resource file name to be used can be specified using a configuration parameter in the portlet.xml, c2a-nls-file.
- The value should be the file name, including the package but omitting the .properties suffix. For example, com.foo.bar.Resource will refer to the file com/foo/bar/Resource.properties or the appropriate locale suffixed version (for example, com/foo/bar/Resource_en.properties). For more information about resource bundles, see Accessing Resources in a Location-Independent Manner in the JDK documentation.
- If this parameter is not specified, the default value of nls.c2a is assumed. This means the that portlet container will look for nls/c2a.properties (or the appropriate locale-suffixed version).
There is an example of the use of this parameter in the portlet.xml of c2asampleshipping.war.
Translation of the action captions and descriptions is supported by specifying, for the caption and description attributes of the <portlet:action> element, the name of the key in the resource bundle where the value of these attributes is to be retrieved. For example,
<portlet:action name="orderDetails" caption="Order.Details" description="Get.details.for.specified.order.id"/>The values for these attributes are obtained from the appropriate resource bundle:
Order.Details=Order Details Get.details.for.specified.order.id=Get details for specified order idYou can support translation of the caption and description attributes values of the encodeProperties tag. To achieve this, these values must be entered as a key in the appropriate c2a_xx.properties file with the string to be displayed on the right hand side. For example:
Send.to.all=Send to allPortlets can also support the translation of captions and descriptions using the setLocalizationInfo() method. See the example under Programmatically registering properties.
See also