Custom Resource Bundle
The Java™ API enables you to fetch custom messages from your custom message XML file.
To use a custom message, add the message in the following format to the resource XML file stored
in the $TOP/locales/xy_XY/custom_resource_bundle directory, where
xy
is the language identifier and XY is a valid region identifier for the language.
The message is picked up by the Java API
com.ibm.pim.utils.MessageBundle automatically, and is then available for your
code. In the sample code, the resource XML file is in the
$TOP/locales/en_US/custom_resource_bundle directory to provide the custom
resource bundle in English (United States)
locale:<?xml version="1.0" encoding="UTF-8"?>
<trigoResources locale="en_US" description="English (US)" version="1.0">
<message id="MESSAGE_ID01"><![CDATA[Hello, World!]]></message>
<message id="MESSAGE_ID02"><![CDATA[Dear {0}, Welcome to IBM Product Master]]></message>
</trigoResources>
You
can access the custom message through the following sample
code: Context pimctx = PIMContextFactory.getContext("Admin","trinitron","trigo");
String message = pimctx.getMessageBundle().getMessage("CUSTOM.MESSAGE_ID02",new String [] {"Trinitron"});