O'Reilly logo

JavaBeans Unleashed by Rick Leinecker, Dr. Donald Doherty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Localizing Objects

Internationalize your beans by isolating locale-specific code and data.

  • Represent a locale using Java's Locale class.

  • Encapsulate locale-specific data in resource bundles.

Using Java's Locale Class

Java's Locale class represents a specific geographic, political, or cultural region. Create a Locale object for each locale you want represented. Locale objects do not encapsulate any data related to the locale represented.

The Locale class is part of the java.util package. Create a Locale object using one of the Locale class's two constructors.

Locale(String language, String country)
Locale(String language, String country, String variant)

Pass a String object encapsulating a special code representing the language you want encapsulated ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required