|
|
Moap is based on Struts which offers good support for internationalisation
based on java i18n. The current realease already take advantage of these feaures.
The default user interface is stored in a resource bundle. A resource bundle
is a file containing name/value pairs. The resource bundle for Moap is called
WebResources.properties.
The Struts tags loads text out of the bundle by on the name and the correct
value is retrieved based on your locale settings.
Name/value pairs in the English resource bundle might look like this:
pagekey.paramkey.yes = Yes
The German resource bundle contains the same names, but different values:
pagekey.paramkey.yes = Ja
Making your own translation involves copying the English resource bundle,
renaming the file and finally translating its contents.
You'll need to rename the file to be specific to your locale.
For example, the German resource bundle is named "WebResources_de.properties"
because "de" is the language code for German.
For French, the file would be called "WebResources_fr.properties".
A list of language codes can be found at: http://www.loc.gov/standards/iso639-2/langhome.html
When translating from English, you might need to use special characters for
you language (for example, Germans use characters like ä, ü, or ß).
Unfortunately, all resource bundle files must be saved in ASCII format which
doesn't allow for many international characters.
It's recommened you work on your translation in a text editor that supports
all characters in your language. After finishing your translation, use the
"native2ascii" tool (built in to Java) to convert international characters
to the ASCII format.
The purpose of native2ascii tool is to generate Unicode characters for a
given set of characters in a file. To support intenationalization java
expects all characters to be in Unicode format in the properties file. The
alphabets already encoded in Unicode are listed here :
http://www.unicode.org/charts/
Here's how you use the native2ascii tool:
native2ascii -encoding XXX WebResources_native.properties WebResources_YY.properties
The "-encoding XXX" parameter is optional.
If you don't specify it, Java will use the default encoding value, taken
from System property "file.encoding". If you do specify the encoding (XXX) of the input
file, it must be taken from the first column of the table of supported
encodings in the Supported Encodings document that can be found here:
http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
The supported encodings have greatly increased between 1.3.1 and 1.4.2 jsdk.
Mainly, native2ascii supports : UTF-8, ISCII91, BIG5, Shift-JIS...and many others !
-- JordaneRollin - 11 Feb 2004
|
|