My requirement is to display localized text messages in a J2EE web application. I know J2EE provides very good support for this. My question is what is the practice followed to have the localized messages stored to be used by the application. If I want to display Japanese / Chinese kind of messages which are not like English like char sets how do we get that messages/text into the properties files or Database tables.
+1
A:
Resource Bundle. The basic idea is for all text to be localized/internationalized to be abstracted out and replaced by 'key' in source code, and at runtime you can switch among locales. Different implementation of resource bundles are available to be selected from, e.g. list resource bundle or properties resource bundle. It's also possible to write your own implementation, like database-backed.
Java Internationalization: Localization with ResourceBundles is a good and quick starting point.
Interestingly, Try alternatives to ResourceBundle lists some disadvantages of resource bundle and provides an alternative.
bryantsai
2010-01-04 06:01:57
Tahnks for the response. My question is how do we get localized data I mean japanese text into the properties file. Can we enter that using key board.What is the practice that is followed here.
Eager Learner
2010-01-04 08:52:47
Localized properties bundles are commonly first entered in native encoding (chinese, japenese), then use "native2ascii" (http://java.sun.com/javase/6/docs/technotes/tools/windows/native2ascii.html) to trans-code to unicode. There is also helper tools for automating this step, like "native2ascii-maven-plugin" (http://mojo.codehaus.org/native2ascii-maven-plugin/)
bryantsai
2010-01-04 09:14:58
Thanks that sorts of answers the question.If you could throw light on how the localized properties are entered first in native encoding that would be really helpful. Is there any way that we can do this in Windows environment.
Eager Learner
2010-01-04 10:14:16
If you are asking how to actually manually 'key in' Chinese or Japanese or whatever localized text ... take Chinese for example, you need to first enable Chinese language support in Windows (not necessarily of Chinese edition) as well as one of its Chinese IME. Also need to change the system default encoding to be the preferred one (Big-5 for my case). But I doubt it would be easy or even possible for you to type in foreign language (I don't know how to key in Japanese) unless you're familiar with it.
bryantsai
2010-01-04 11:29:30
Thanks a lot Bryantsai that answers my question.
Eager Learner
2010-01-04 12:43:48