Posted by joconner
on December 15, 2004 at 9:39 PM PST
Now that MyJxta2 has externalized text into a resource bundle, localization is easy. Can you help by providing a localization?
The JXTA group just released a new version of their product, version 2.3.2, code name "Imam Bayaldi." What a name! A quick Google search on Imam Bayaldi tells me that this is an eggplant and tomato recipe...but that's another subject.
One of the key demo applications included in the download is a program called MyJxta2. It's essentially a chat application, with lots of interesting features. My reason in bringing this up is that the author took some of my advice concerning internationalization. He separated his UI text from his core source code and placed the key/value pairs into a PropertyResourceBundle. This allows you, the user community, to localize the product into your language, whether that language be Spanish, German, French, or ...well, you get the picture.
How do you take advantage of this? How do you translate MyJXTA2?
- After downloading the source, find the resource bundle at net.jxta.myjxta2.resources.text.text.properties.
- Load the text.properties file into your favorite editor.
- Without changing the keys on the left, edit the values on the right to corresponding terms in your target language.
- Save the text.properties file as text_.properites or text__.properites if your language is specific to a particular region. Some languages, even English, can use different terms for the same object, ie car hood (en_US) and bonnet (en_UK). So sometimes the 3166 code is necessary.
- Use native2ascii to convert the file to \uXXXX notation if your character set is anything other than ISO 8859-1 or Latin-1.
- Submit the result to firstname.lastname@example.org.
Here are a few entries from text.properties:
Editing this in my editor, and translating to Japanese, I might write this:
Now, what's next? We save the file of course. Since this is Japanese, we save the file as
text_ja.properties. My editor can save files in a variety of charsets. Let's asssume I saved the file in the SJIS charset. Your editor may only save to your local charset. Once you save the file, there's just one problem...Japanese cannot be represented natively in Latin-1. So, I have to use the native2ascii tool to convert this file from a native encoding like Shift-JIS, JIS, or maybe even a Unicode encoding like UTF-8 to \uXXXX notation that is ASCII compatible. I can use this tool like so:
native2ascii -encoding SJIS text_ja.properties foo.properties
mv foo.properties text_ja.properties
text_ja.properties file still contains the Japanese localized text, but it has been converted so that it can be used by the Java platform. Of course, it does look a little different in an editor:
Place this file (text_ja.properties or whatever you've created) into your source package for resources, build, and you have a MyJxta2 app capable of displaying its UI in Japanese. Impressive.
Hava some fun creating your own localization of MyJxta2. Don't forget to contribute back to the JXTA community by sending your localized file to email@example.com!