Internationalization in Java

Profile picture for user arilio666

In this article, we will discuss what internationalization is in Java.

What is Internationalization?

  • It is the process of designing any web application so that it automatically provides support for various countries, languages, and currencies.
  • This should be done without performing any change in the application. This is called internationalization(I18N).
  • I18N is referred to because, between I and N, there are 18 characters.
  • It is one of the powerful concepts of Java when an application is developed and want to display messages, currencies, dates, time, etc.
  • This is done according to a specific region or language.

Here are some of the critical aspects of internationalization in Java:

Locale: A locale is a specific geographical, political, or cultural region. In Java, the Locale class provides a way to represent a particular locale. You can create a Locale object by specifying a language and a country code.

ResourceBundle: A ResourceBundle is a set of key-value pairs that can provide localized resources for an application. 

MessageFormat: The MessageFormat class provides a way to format messages that contain dynamic data.

DateFormat: The DateFormat class provides a way to format dates and times based on the user's locale. 

NumberFormat: The NumberFormat class provides a way to format numbers based on the user's locale.


    double d = 44.33;
        NumberFormat nf = NumberFormat.getInstance(Locale.GERMANY);
        NumberFormat nf1 = NumberFormat.getInstance(Locale.UK);
        NumberFormat nf2 = NumberFormat.getInstance(Locale.JAPANESE);
        System.out.println("Germany representation of " + d + " : " + nf.format(d));
        System.out.println("UK representation of " + d + " : " + nf1.format(d));
        System.out.println("Japanese representation of " + d + " : " + nf2.format(d));
  • Here we have used a number format according to locale and selected some countries on how they are represented.