In last few months I have been working on I18N. During this project activity I realized need to document the I18N experience. Most of the time programs are not written considering internationalized distribution. So we get in to the task of defining what can be internationalized (Scope). There is good link which provides checklist for this task
http://java.sun.com/docs/books/tutorial/i18n/intro/checklist.html
There are lots of tutorials available on net for implementing I18N for java app. listing few of them that I referred,
For I18N of java Application
http://java.sun.com/docs/books/tutorial/i18n/index.html
For I18N of JSF application
http://www.javabeat.net/tips/102-implement-internationalization-and-localizati.html
Eclipse provide plug-in to externalize messages from java application have a look at this url
http://www.eclipse.org/articles/Article-Internationalization/how2I18n.html
Sorting String
http://java.sun.com/docs/books/tutorial/i18n/text/collationintro.html
http://w3hjava.com/?p=3
For handling number formatting
http://www.ibm.com/developerworks/java/library/j-numberformat/
In rest of the post I will be writing about the problems we faced while doing Internationalization.
- Alphabets are shown incorrectly in Japanese, German language messages.
Though the properties files contain proper translation the messages shown incorrectly with BOM characters. This problem occurred because Java compiler and other Java tools can only process files which contain ASCII character-set. So we need to convert our properties files in non English languages so that the Non-ASCII characters should be converted in to ASCII “\u####“ notation. For that java provides native2ascii Converter, please refer the link
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/native2ascii.html
In our project we used native2ascii ant task for this purpose
http://ant.apache.org/manual/OptionalTasks/native2ascii.html
- {0} placeholders in parametrized messages are not replaced in French language .
This problem caused because of MessageFormat Class that we used to replace placeholders . This class treat single quote (‘) as delimiter. In French some word contain single quote this lead to the problem. For us we replaced single quote (‘) with double single quote (‘’) for parametrized messages before passing them to message format.
- Resource bundle returns English messages though other language locale is configured.
We have all our properties as per locale and converted using native2ascii tool still our other language messages are messed up. This problem was caused because of properties file. While adding new messages we used different editors like notepad, editplus, etc. These editors add some header at the beginning of file so that they can identify file encoding while opening it in future. This cause problem as some of our properties file contains messages from first line. So the resource bundle was unable to load those properties. So we added some commented messages at the beginning of properties file and our problem was solved.
- Storing and sorting strings in database
For this we need to change the column type from varchar to nvarchar. Also sorting of strings requires the sorting algorithm to be aware of the language of the strings being sorted. Since sorting is done differently in different languages. For this reason, even the DB needs to be informed of the collation setting so that ORDER BY queries return data in the correct order.
http://msdn.microsoft.com/en-us/library/aa174903%28SQL.80%29.aspx