List of all Locales

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

List of all 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.

Here is the video tutorial of: "How to get list of Locales in Java?"

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