Home Java Javatutorial Locale list
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Locale list

Advertisement
This tutorial extensively highlight that what are the set of locales and also defines the factors, which help you in identifying the installed locales for your purposes.

Locale list

This tutorial provides you all the list of locales that is a set of parameters and it define the user's languages, country and other special variants. These are the factors, which help you in identifying the languages and region for a particular circumstance.

The below examples shows you list of locales. In the code given below we are showing you list of locales. It also be in your mind that having a whole list of locale is of no use and you can use only those locales which are installed on the concerned system. For this purpose, first of all you will have to find out the list of installed locales.

You should also keep in your mind that there are important formatting differences especially for date and time and also other differences in spelling and also in terminology.

Methods used in this example are described below:

SimpleDateFormat.getAvailableLocales():

To parse dates in a locale-sensitive manner, you can use SimpleDateFormat class. Further, the getAvailableLocales method returns an array of all locales.

Locale.getDisplayName() :

It is noted that Locale object represents a specific representative, political, or cultural region. Thus an operation that requires a Locale to execute its task is called locale-sensitive. Again the uses the Locale for the sartorial information to 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

Advertisements

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: October 9, 2013

Related Tutorials

Ask Questions?    Discuss: Locale list  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com