GWT i18n Overview
Google Web Toolkit is an out of the box set of APIs that allows developing Ajax applications easily using Java technology.
There is a need in certain applications to allow the user chooses the languages he prefers to see contents with, so as he can understand what the project is all about and can be therefore a potential customer.
GWT provides great support for internationalization (i18n), and this is true by providing specific classes to use :
- Constants : Used when externalizing static constants to different languages.
- ConstantsWithLookup : Used when externalizing static constants to different languages like Constants interface, but adding the ability to load dynamically a value of a property at runtime.
- Messages : Used when externalizing static constants with parameters to different languages.
- Dictionary : Corresponds to a dictionary included to the host page at first page loading.
- Localizable : specializes a class behaviour depending on the used locale.
- DateTimeFormat & NumberFormat : utility classes provided to format dates and numbers at the client side.
- CurrencyCodeMapConstants : currency dictionary to use directly in your application.
Moreover, GWT provides a command line tool called “i18Creator” to generate language properties file or interfaces automatically because doing this by hand could be a daunting task. “i18Sync” is another tool provided by GWT that takes in input language properties files and generates automatically interfaces as output.
Good luck with GWT i18n.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)