Ad Home

Theme images by kelvinjay. Powered by Blogger.

Travel

Header Ads

Java

Selenium

UFT

Framework

General QA Concept

BDD

» » » Internationalization Concept Simplified In Java Part-1

Generally when we design an application in client server mechanism,the request is initiated by client and fulfilled by server. Now when application grows bigger and bigger it crosses the boundaries of nations.. Think about leading   online product selling sites. May be clients from India,UK,US,China and many more. Clients are sending request to server. Server has to understand the client's location and if it provides feedback according to country nothing great like that. Imagine we are buying some cloths from online and the billing amount is $20.49. Now we need to go back to the calculator and calculate accordingly. There is always problems with conversion. But think if this is coming as Rs1009. Easy to understand for Indian customer. Is n't it?  In this way customers will be happy to be back in the portal again and again.So response from server will be different from India and US.
so,Internationalization is also known as I18N. It is a process of designing applications in such a way that supports various countries and various currencies automatically.

Let us understand by what way we can implement I18N..
  • Locale
  • NumberFormat
  • DateFormat
Locale:

A locale object represents a geographic location or language.It presents in Java.util package and it is a final class.It is a direct child class of Object and implements Serializable and cloneable interface.It already contains some predefined constants represents some standard Locales like...
  • Locale.US
  • Locale.UK
  • Locale.ITALY
  • Locale.ENGLISH

We can create Locale object by using the following constructors..
  • Locale l=new Locale(String language);
  • Locale l=new Locale(String Language,String Country)
Ex:
Locale l=new Locale("ba","IN");
//ba=bengali,country=India
Locale l=new Locale("ba","BD");
//ba=bengali,country=Bangladesh


public static Locale getDefault();
public static void setDefault(Locale l);
public Sting getCountries();//US
public Sting getLanguage();//en
public Sting getDisplayCountry);//United States
public Sting getDisplayLanguage()//english
public static String[] getISOLanguages();
public static String[] getISOCountries();
public static Locale[] getAvailableLocales();



The output will be as follows...
Default en_US
Default en
Default United States
Default English
Default after setting Locale Panjabi
aa
ab
ae
af
ak
am
an
ar
as
av
ay
az
ba
be
bg
bh
bi
bm
bn
bo
br
bs
ca
ce
ch
co
cr
cs
cu
cv
cy
da
de
dv
dz
ee
el
en
eo
es
et
eu
fa
ff
fi
fj
fo
fr
fy
ga
gd
gl
gn
gu
gv
ha
he
hi
ho
hr
ht
hu
hy
hz
ia
id
ie
ig
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TT
TV
TW
TZ
UA
UG
UM
US
UY
UZ
VA
VC
VE
VG
VI
VN
VU
WF
WS
YE
YT
ZA
ZM
ZW


«
Next
Newer Post
»
Previous
Older Post

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete