List of all Locales

SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. It allows for formatting (date -> text), parsing (text -> date), and normalization.

SimpleDateFormat.getAvailableLocales() method returns an array of Locale objects for which localized DateFormat instances can be obtained.

Code snippet below lists all available locales

ListAllLocales.java

package com.bharat.examples;

import java.text.SimpleDateFormat;
import java.util.Locale;

public class ListAllLocales {

	static public void main(String[] args) {

		Locale list[] = SimpleDateFormat.getAvailableLocales();

		for (int i = 0; i < list.length; i++) {
			System.out.printf("%40s : %20s \n" , list[i].getDisplayName(),list[i].toString());
		}
	}
}

Output

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

References

http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

Advertisements

, ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: