Beruflich Dokumente
Kultur Dokumente
---------------------------
Designing Java applications w.r.t the local users is called as
Internationalization.
1.Number Formations
2.Date Foamtions
3.Message Formations
1.Number Formations:
---------------------
From language to language, country to country number representations are varied.
Torepresent numbers w.r.t a particular Locale JAVA has provided a predefined class
in the from of "java.text.NumberFormat"
Date Formations:
------------------
From language to language, country to country Date representations are varied. To
represent Dates w.r.t a particular Locale JAVA has provided a predefined class in
the from of "java.text.DateFormat"
Example:
---------
import java.util.*;
import java.text.*;
class I18NEx
{
public static void main(String[] args)throws Exception
{
Locale l=new Locale("it","IT","win");
DateFormat df=DateFormat.getDateInstance(3,l);
System.out.println(df.format(new Date()));
}
}
3.Message Formations:
----------------------
From language to language , from country to country, messages repersentations are
varied, if we want to represent message w.r.t a particular Locale then we have to
use java.util.ResourceBundle class provided by JAVA.
File_name_<lang>_<country>_<sys_Var>.properties
EX1: abc_en_US.properties
--------------------------
welcome=Welcome to en US Users.
EX2: abc_it_IT.properties
-------------------------
welcome=Welcomeo Toe it IT Userse.
EX3: abc_hi_IN.properties
--------------------------
welcome=Aap ka swagath hai.
String message=rb.getString("welcome");
Example:
--------
abc_en_US.properties
--------------------------
welcome=Welcome to en US Users.
abc_it_IT.properties
-------------------------
welcome=Welcomeo Toe it IT Userse.
abc_hi_IN.properties
--------------------------
welcome=Aap ka swagath hai.
I18NEx.java
------------
import java.util.*;
class I18NEx
{
public static void main(String[] args)throws Exception
{
Locale l=new Locale("hi","IN");
ResourceBundle rb=ResourceBundle.getBundle("abc",l);
System.out.println(rb.getString("welcome"));
}
}