The ResourceMaker tool

Resource description file and Resource file

Internationalisation and localisation of a MIDlet requires a resource file (RES file) that defines all the resource content used by the MIDlet for translating the resource content as per the locale selected. The resource content is initially defined as an XML file as per the resources document type definition (resources.dtd) scheme, and then converted to a binary RES file using the ResourceMaker tool.

The following is an example for an XML resource description file created as per the resources.dtd scheme:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources SYSTEM "resources.dtd">

<resources version="1.0"> <!-- JSR-238 version number -->

	<!-- Resources for the FormattingDemo MIDlet -->
	<set basename="FormattingRes">

		<resource id="50" type="string" name="LABEL_CURRENCY" comment="Own currency">
			<value locale="en">Own currency</value>
			<value locale="fi-FI">Oma valuutta</value>
		</resource>

	</set>

</resources>

The ResourceMaker tool

The ResourceMaker tool takes an XML document as input and produces one or more JSR-238 resource files.

The general usage is:

 java com.nokia.phone.ri.global.tools.ResourceMaker resFileURL srcDir destDir baseName locale…

where the options are as follows:

resFileURL - The full URL of the resource description file, such as C:/MyProjects/GlobalTest/src/res.xml.

srcDir - Source directory for the resources referred to from the XML description file.

destDir - Destination directory to put resources in ResourceMaker will create a subdirectory named global in the specified directory. See the JSR-238 specification for details.

baseName - The base name of the resources to process. The XML resource description file can contain several sets of resources, which must be processed separately.

locale... - One or more locales to process. The option must match the locale attributes in the XML resource file.

The ResourceDumper tool

The ResourceDumper tool is an easy way to check if the binary resource file you are using is correct. The tool writes information about the contents of the resource files to the console.

The general usage is:

java com.nokia.phone.ri.global.tools.ResourceDumper \baseDir baseName locale

where the options are as follows:

baseDir - The directory to search resource files from (one level above the global subdirectory).

baseName - The base name of the resources.

locale - The locale of the resources.

Note: For string resources, the length information reflects the actual length of the resource, not the decoded string. Many Unicode characters use more than one byte of storage in UTF-8 format.

Using the ResourceMaker tool

  1. Download and unzip the JSR_238_RI_1_0.zip file to your computer.

  2. Create a new XML file with translated resources as per resources.dtd scheme.

  3. Open Command Prompt and change directory to ResourceMaker/bin directory.

  4. Run java com.nokia.phone.ri.global.tools.ResourceMaker resFileURL srcDir destDir baseName locale…

  5. The ResourceMaker tool will create a global subdirectory in the destination directory with the converted RES file.

Note: Copy the generated global folder to your Nokia IDE for Java ME (Eclipse) project’s res folder and develop the MIDlet.