Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Tutorials I18N List of all Locales

Related Tutorials


 
 

Share on Google+Share on Google+

List of all Locales

Advertisement
This Example shows you list of locales. In the code given below we are showing you list of locales.

List of all Locales

     

This Example shows you list of locales. In the code given below we are showing you list of locales.

Methods used in this example are described below :

SimpleDateFormat.getAvailableLocales() : SimpleDateFormat class is using for format and parse dates in a locale-sensitive manner. getAvailableLocales method returns an array of all locales.

Locale.getDisplayName() : A Locale object represents a specific representative, political, or cultural region. An operation that requires a Locale to execute its task is called locale-sensitive and uses the Locale to sartorial information for the user.getDisplayName method is return an array of all installed locales.

LocalesList.java
import java.text.SimpleDateFormat;
import java.util.*;

public class LocalesList {

  static public void main(String[] args) {

  Locale list[] = SimpleDateFormat.getAvailableLocales();
   Set set = new TreeSet();
  for (int i = 0; i < list.length; i++) {
  set.add(list[i].getDisplayName() 
  +
"\t\t\t:\t"+ list[i].toString());
  }
  Iterator it = set.iterator();
  while (it.hasNext()) {
  System.out.println(it.next() );
  }
  }
}

Output :

Albanian (Albania) :   sq_AL
Albanian :   sq
Arabic (Algeria) :   ar_DZ
Arabic (Bahrain) :   ar_BH
Arabic (Egypt) :   ar_EG
Arabic (Iraq) :   ar_IQ
Arabic (Jordan) :   ar_JO
Arabic (Kuwait) :   ar_KW
Arabic (Lebanon) :   ar_LB
Arabic (Libya) :   ar_LY
Arabic (Morocco) :   ar_MA
Arabic (Oman) :   ar_OM
Arabic (Qatar) :   ar_QA
Arabic (Saudi Arabia) :   ar_SA
Arabic (Sudan) :   ar_SD
Arabic (Syria) :   ar_SY
Arabic (Tunisia) :   ar_TN
Arabic (United Arab Emirates) :   ar_AE
Arabic (Yemen) :   ar_YE
Arabic :   ar
Belarusian (Belarus) :   be_BY
Belarusian :   be
Bulgarian (Bulgaria) :   bg_BG
Bulgarian :   bg
Catalan (Spain) :   ca_ES
Catalan :   ca
Chinese (China) :   zh_CN
Chinese (Hong Kong) :   zh_HK
Chinese (Singapore) :   zh_SG
Chinese (Taiwan) :   zh_TW
Chinese :   zh
Croatian (Croatia) :   hr_HR
Croatian :   hr
Czech (Czech Republic) :   cs_CZ
Czech :   cs
Danish (Denmark) :   da_DK
Danish :   da
Dutch (Belgium) :   nl_BE
Dutch (Netherlands) :   nl_NL
Dutch :   nl
English (Australia) :   en_AU
English (Canada) :   en_CA
English (India) :   en_IN
English (Ireland) :   en_IE
English (Malta) :   en_MT
English (New Zealand) :   en_NZ
English (Philippines) :   en_PH
English (Singapore) :   en_SG
English (South Africa) :   en_ZA
English (United Kingdom) :   en_GB
English (United States) :   en_US
English :   en
Estonian (Estonia) :   et_EE
Estonian :   et
Finnish (Finland) :   fi_FI
Finnish :   fi
French (Belgium) :   fr_BE
French (Canada) :   fr_CA
French (France) :   fr_FR
French (Luxembourg) :   fr_LU
French (Switzerland) :   fr_CH
French :   fr
German (Austria) :   de_AT
German (Germany) :   de_DE
German (Luxembourg) :   de_LU
German (Switzerland) :   de_CH
German :   de
Greek (Cyprus) :   el_CY
Greek (Greece) :   el_GR
Greek :   el
Hebrew (Israel) :   iw_IL
Hebrew :   iw
Hindi (India) :   hi_IN
Hungarian (Hungary) :   hu_HU
Hungarian :   hu
Icelandic (Iceland) :   is_IS
Icelandic :   is
Indonesian (Indonesia) :   in_ID
Indonesian :   in
Irish (Ireland) :   ga_IE
Irish :   ga
Italian (Italy) :   it_IT
Italian (Switzerland) :   it_CH
Italian :   it
Japanese (Japan) :   ja_JP
Japanese (Japan,JP) :   ja_JP_JP
Japanese :   ja
Korean (South Korea) :   ko_KR
Korean :   ko
Latvian (Latvia) :   lv_LV
Latvian :   lv
Lithuanian (Lithuania) :   lt_LT
Lithuanian :   lt
Macedonian (Macedonia) :   mk_MK
Macedonian :   mk
Malay (Malaysia) :   ms_MY
Malay :   ms
Maltese (Malta) :   mt_MT
Maltese :   mt
Norwegian (Norway) :   no_NO
Norwegian (Norway,Nynorsk) :   no_NO_NY
Norwegian :   no
Polish (Poland) :   pl_PL
Polish :   pl
Portuguese (Brazil) :   pt_BR
Portuguese (Portugal) :   pt_PT
Portuguese :   pt
Romanian (Romania) :   ro_RO
Romanian :   ro
Russian (Russia) :   ru_RU
Russian :   ru
Serbian (Bosnia and Herzegovina) :   sr_BA
Serbian (Montenegro) :   sr_ME
Serbian (Serbia and Montenegro) :   sr_CS
Serbian (Serbia) :   sr_RS
Serbian :   sr
Slovak (Slovakia) :   sk_SK
Slovak :   sk
Slovenian (Slovenia) :   sl_SI
Slovenian :   sl
Spanish (Argentina) :   es_AR
Spanish (Bolivia) :   es_BO
Spanish (Chile) :   es_CL
Spanish (Colombia) :   es_CO
Spanish (Costa Rica) :   es_CR
Spanish (Dominican Republic) :   es_DO
Spanish (Ecuador) :   es_EC
Spanish (El Salvador) :   es_SV
Spanish (Guatemala) :   es_GT
Spanish (Honduras) :   es_HN
Spanish (Mexico) :   es_MX
Spanish (Nicaragua) :   es_NI
Spanish (Panama) :   es_PA
Spanish (Paraguay) :   es_PY
Spanish (Peru) :   es_PE
Spanish (Puerto Rico) :   es_PR
Spanish (Spain) :   es_ES
Spanish (United States) :   es_US
Spanish (Uruguay) :   es_UY
Spanish (Venezuela) :   es_VE
Spanish :   es
Swedish (Sweden) :   sv_SE
Swedish :   sv
Thai (Thailand) :   th_TH
Thai (Thailand,TH) :   th_TH_TH
Thai :   th
Turkish (Turkey) :   tr_TR
Turkish :   tr
Ukrainian (Ukraine) :   uk_UA
Ukrainian :   uk
Vietnamese (Vietnam) :   vi_VN
Vietnamese :   vi

Download code

     

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: September 13, 2008

Related Tutorials

Discuss: List of all Locales  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:2
Devendra
July 22, 2012
nytOZLPLXSiC

i wanna thank u for this great effort. i'm itesreentd in languages and i believe that English is the most important language that everyone should learn becz it's the language of science and technology.Speaking English fluently depends on the stock of vocab a person has & how to use them correctly.As Saudis, we have problems in English ( especially in speaking and writing. i.e. the productive language ).I suggest that when u write new words ( as u do ), u may explain or show how to use them in spoken and written texts.Wish u all the best.&May Allah bless u.
prish
June 25, 2013
wrong!!

This doesn't return tamil(ta_IN) or sinhalese(si_LK) locales.
DMCA.com