Skip to content
Related Articles

Related Articles

Internationalization(I18N) in java
  • Difficulty Level : Basic
  • Last Updated : 31 Jan, 2018

Internationalization(I18N) : The process of designing web applications in such a way that which provides support for various countries, various languages and various currency automatically without performing any change in the application is called Internationalization(I18N). It is know as I18N because between I and N there is 18 characters thats why I18N.

Example: We all know about amazon website, it is world-wide available. We Indians also access the website and any other country person also access the website. If any request is coming from Indian person then the response from the amazon website should be in the form which is understandable by Indian People like Currency should be in INR etc. But at the same time if US people access the website then the response/information given by the website should be in some form which is understandable by US people like here currency should be in $. The above process is known is Internationalization(I18N).

We can implement Internationalization by using the following 3 classes:

  • Locale
  • NumberFormat
  • DateFormat

// Java Program to illustrate Program 
// without Internationalization
public class InternationalizationDemo
    public static void main(String[] args) 
        System.out.println("How are you?");

Explanation: If we want that this program needs to display these same messages for people living in ITALY and SPAIN. Unfortunately Our programming staff is not multilingual, then we have to translate the above message in ITALY and SPAIN. suppose we dont know languages of ITALY and SPAIN . Then our program will not word for ITALY and SPAIN people. It looks like the program needs to be internationalized.

// Java Program to illustrate Program with 
// Internationalization
import java.util.*;
import java.text.*;
class NumberFormatDemo {
    public static void main(String[] args)
        // Here we get the below number
        // representation in various countries
        double d = 123456.789;
        NumberFormat nf = NumberFormat.getInstance(Locale.ITALY);
        NumberFormat nf1 = NumberFormat.getInstance(Locale.US);
        NumberFormat nf2 = NumberFormat.getInstance(Locale.CHINA);
        System.out.println("ITALY representation of " +
                            d + " : " + nf.format(d));
        System.out.println("US representation of " +
                            d + " : " + nf1.format(d));
        System.out.println("CHINA representation of "
                            d + " : " + nf2.format(d));


ITALY representation of 123456.789 : 123.456, 789
US representation of 123456.789 : 123, 456.789
CHINA representation of 123456.789 : 123, 456.789

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :