61 lines
2.3 KiB
HTML
61 lines
2.3 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
|
||
|
|
||
|
<title>Create message catalogs</title>
|
||
|
</head>
|
||
|
|
||
|
<BODY>
|
||
|
<!-- Java sync-link -->
|
||
|
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
||
|
|
||
|
<h5><A NAME="intercrtmsg"></A>Create message catalogs</h5>
|
||
|
|
||
|
<p>You can create a catalog several ways:
|
||
|
<ul>
|
||
|
<li>As a subclass of java.util.ResourceBundle</li>
|
||
|
<li>As a Java properties file</li>
|
||
|
</ul>
|
||
|
The properties file approach is more common, because properties files can be prepared by people without programming experience and can be added into the application without modifying the application code.</p>
|
||
|
|
||
|
<p>Perform the following steps to create message catalogs:</p>
|
||
|
|
||
|
<ol>
|
||
|
<li><p>For each string identified for localization, add a line to the
|
||
|
message catalog that lists the string's key and value in the current language.</p>
|
||
|
<p>In a properties file, each line has the following structure:
|
||
|
<pre><em>key</em> = <em>string associated with the key</em></pre>
|
||
|
</p></li>
|
||
|
<li><p>Save the catalog, and give it a locale-specific name.</p>
|
||
|
<p>To enable resolution to a specific properties file, the Java API specifies
|
||
|
naming conventions for the properties files in a resource bundle as <em>bundleName_localeID</em>.properties. Give the set of message catalogs a collective name (for example, <tt>BankingResources</tt>).</p>
|
||
|
<p>For information about locale IDs that are recognized by the Java API, see
|
||
|
<a href="interres.htm">Internationalization resources</a>.</p>
|
||
|
</li>
|
||
|
</ol>
|
||
|
|
||
|
<p><strong>Example: Message catalogs</strong></p>
|
||
|
|
||
|
<p>The following English catalog (BankingResources_en.properties)
|
||
|
supports the labels for the list and two list items:</p>
|
||
|
<blockquote>
|
||
|
<pre>accountString = Accounts
|
||
|
savingsString = Savings
|
||
|
checkingString = Checking</pre>
|
||
|
</blockquote>
|
||
|
|
||
|
<p>The corresponding German catalog (BankingResources_de.properties)
|
||
|
supports the labels as follows:</p>
|
||
|
<blockquote>
|
||
|
<pre>accountString = Konten
|
||
|
savingsString = Sparkonto
|
||
|
checkingString = Girokonto</pre>
|
||
|
</blockquote>
|
||
|
|
||
|
<p><strong>Next step: </strong><a href="intercode.htm">Assemble your application code</a>.</p>
|
||
|
|
||
|
</body>
|
||
|
</html>
|