Share on Google+Share on Google+

Internationalization and Localization of Web Applications in Java

Advertisement
In this tutorial you will learn about the internationalization and localization of web applications in java.

Internationalization and Localization of Web Applications in Java

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.

Class for Localization in Java

java.util.Locale

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.

java.util.ResourceBundle

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).

Locale Setting

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 Setting

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>

Advertisements

Advertisement

Posted on: December 7, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Internationalization and Localization of Web Applications in Java  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0