How to Internationalization java applications

How do we Internationalization in java

Usually, applications are developed in English, but when we want our applications
to target users or customers of different countries, Sun provides Internationalization concept in java.
Internalization or I18n is a set of Java classes or interfaces provided by java to support the global application in java. It means Java applications work with multiple languages and multiple countries.

What are items to do in Internationalization
2.Time Zone
4. Message Format
6.current symbol

when we target above things, the application is named as internationalized applications

In simple terms, we develop applications in one language and can change to different local or localize the applications by doing the above things.
In java, java.util.Locale class holds localized information

For example, have coded for creating a button in swing

JButton buttonEx=new JButton(“Upload”);

here, button label message is hardcoded, It is very difficult if we want to develop this application to target different regions.

To Localize the application, we have to separate the labels and place them in property or resource file.

label message in the resource file for US country is

button.upload.label =Upload–

In the same way, we need to create one resource property file for each country or language. This can be added to an application after application development is done.

button.upload.label = starten–

In java, java.util.ResourceBundle is used to read resource bundles or property files.

In order to read resource files, we can use java.util.ResourceBundle.

Creating resourceBundle

ResourceBundle rb = ResourceBundle.getBundle(basename, locale);

The above code will read the locale-specific resource file, if it is not found, default locale resource is considered.

In Java applications, java.text.DateFormat,
java.text.NumberFormat, java.text.MessageFormat are used to achieve Internationalization

If you like this post, please share by clicking google +1 button

Similar Posts