Mohammed Amine TAZI is a Sun Certified Enterprise Architect and J2EE developer. He's passionate about J2EE technology and learning foreign languages. Mohammed Amine is a DZone MVB and is not an employee of DZone and has posted 4 posts at DZone. View Full User Profile

GWT i18n Overview

09.16.2010
| 4900 views |
  • submit to reddit

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.

From http://www.misterj2ee.com/2010/09/gwt-i18n-overview/

Published at DZone with permission of Mohammed Amine Tazi, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: