What is a locale and why is it useful?

swarraj kulkarni

A Locale object represents and provides various information about "a specific geographical, political, or cultural region," as seen at Locale. However, in and of itself, that's all a Locale does.

It's real reason for being comes in to play when used in conjunction with locale sensitive classes. In this case, a locale is used as an identifier, or, if you prefer to think in database/table terms, a key, for localized information and/or ResourceBundles. This makes it possible for the same code to parse and display information in different formats and languages.

Joe Sam Shirah adds: One should keep in mind that locales are not global in java and that technically, one should call a local sensitive class' getAvailableLocales() method to ensure that it supports a given locale. Fortunately, all of of Java's core locale sensitive classes support the same locale set. See: Supported Locales.

About | Sitemap | Contact