12.1.1 Creating resource bundles in Rational Application Developer

The resource bundles need to be created in the JavaSource directory as illustrated in Figure 12-1. Though not required, as a matter of good practice, you should place the files in a dedicated directory such as nls. To create a new resource bundle in RAD, open the project explorer view in the Web perspective. Locate the JavaSource directory of the portlet you are enabling and right-click. From the context menu, select New | Other.

Figure 12-2 Creating a new folder

Select Simple | Folder and click Next.

Figure 12-3 Creating an nls folder

Enter the name of the new folder, typically nls as shown in Figure 12-4.

Figure 12-4 Creating the nls folder in RAD

In the nls folder, you need to create the default properties files. Select the nls folder and right-click. From the context menu, select New | Other | Simple | File. Be sure the correct directory is selected and enter the name of the default properties file as illustrated in Figure 12-5. Do not include any language codes in the name, or include any spaces in the name of the resource bundle.

Figure 12-5 Creating the default properties bundle

When you are done, double-click the properties file in the navigator to open the simple text editor. Using the text editor, define your keys and the default values, such as those shown in Example 12-1. Use CTRL-S to save the file.


Redbooks
ibm.com/redbooks