In this tutorial you will learn about the internationalization and localization of web applications in java.
Localization of Web applications means that a web application that is created for targeting a local market or an particular enterprise. It is a process of supporting a particular language/locale(Locale is a language or member of a set of language that contains the information of both the regional and specified language ) in an Internationalized application.
Internationalization of Web applications means that a web application that is created for targeting more than one country or which supports number of languages.
Locale class of java.util package contains all the information like specific geographical, political, or cultural region. To represent a defined locales it follows the international standard representation i.e. short form of two characters distinguished by underscore(_) are used to represent the languages and countries names and optional variants.
ResourceBundle class of java.util package stores the locale-sensitive data such as dates, times, currency and numbers in the form of key-value pair where the locale objects in the bundle are identifiable by the unique keys. There are two subclasses in java using which you can also create a resources. ListResourceBundle class is used for managing the resources as list of key-value pairs and PropertyResourceBundle class is used for managing the resource using properties file(.properties).
A locale can be set explicitly by providing the information into the configuration file using the <locale-config> element (you can also use the other methods to set the locale). A web application can finds the locale using the getLocale() method or it may permit the user to choose the locale from the explicitly defined locale. In the configuration file information <locale-config> element can be used as :
<locale-config> <default-locale>en</default-locale> <supported-locale>ja</supported-locale> <supported-locale>it</supported-locale> </locale-config>
Resource bundle information can be set in the configuration file using <resource-bundle> element. Sub elements of <resource-bundle> elements are used as :
<resource-bundle> <base-name> </base-name> <var> </var> </resource-bundle>
Posted on: December 7, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles