how-to

Internationalization

How to list available Locale

For work with Locale class you need to use:

import java.util.Locale;

For listing of available Locale with their codes use this:

Locale[] locales = Locale.getAvailableLocales();

for ( int i = 0; i < locales.length; i++ ) {
  /* 2-letter language code */
  String language = locales[i].getLanguage();

  /* 2-letter country code */
  String country = locales[i].getCountry();

  /* display name */
  String locName = locales[i].getDisplayName();
    
  System.out.println( language + "\t" + country + "\t" + locName );
}

The output is:

ja	JP	Japanese (Japan)
es	PE	Spanish (Peru)
en      English
ja	JP	Japanese (Japan,JP)
es	PA	Spanish (Panama)
sr	BA	Serbian (Bosnia and Herzegovina)
mk      Macedonian
es	GT	Spanish (Guatemala)
ar	AE	Arabic (United Arab Emirates)
no	NO	Norwegian (Norway)
sq	AL	Albanian (Albania)
bg      Bulgarian
ar	IQ	Arabic (Iraq)
ar	YE	Arabic (Yemen)
hu      Hungarian
pt	PT	Portuguese (Portugal)
el	CY	Greek (Cyprus)
ar	QA	Arabic (Qatar)
mk	MK	Macedonian (Macedonia)
sv      Swedish
de	CH	German (Switzerland)
en	US	English (United States)
fi	FI	Finnish (Finland)
is      Icelandic
cs      čeština
en	MT	English (Malta)
sl	SI	Slovenian (Slovenia)
sk	SK	Slovak (Slovakia)
it      Italian
tr	TR	Turkish (Turkey)
zh      Chinese
th      Thai
ar	SA	Arabic (Saudi Arabia)
no      Norwegian
en	GB	English (United Kingdom)
sr	CS	Serbian (Serbia and Montenegro)
lt      Lithuanian
ro      Romanian
en	NZ	English (New Zealand)
no	NO	Norwegian (Norway,Nynorsk)
lt	LT	Lithuanian (Lithuania)
es	NI	Spanish (Nicaragua)
nl      Dutch
ga	IE	Irish (Ireland)
fr	BE	French (Belgium)
es	ES	Spanish (Spain)
ar	LB	Arabic (Lebanon)
ko      Korean
fr	CA	French (Canada)
et	EE	Estonian (Estonia)
ar	KW	Arabic (Kuwait)
sr	RS	Serbian (Serbia)
es	US	Spanish (United States)
es	MX	Spanish (Mexico)
ar	SD	Arabic (Sudan)
in	ID	Indonesian (Indonesia)
ru      Russian
lv      Latvian
es	UY	Spanish (Uruguay)
lv	LV	Latvian (Latvia)
iw      Hebrew
pt	BR	Portuguese (Brazil)
ar	SY	Arabic (Syria)
hr      Croatian
et      Estonian
es	DO	Spanish (Dominican Republic)
fr	CH	French (Switzerland)
hi	IN	Hindi (India)
es	VE	Spanish (Venezuela)
ar	BH	Arabic (Bahrain)
en	PH	English (Philippines)
ar	TN	Arabic (Tunisia)
fi      Finnish
de	AT	German (Austria)
es      Spanish
nl	NL	Dutch (Netherlands)
es	EC	Spanish (Ecuador)
zh	TW	Chinese (Taiwan)
ar	JO	Arabic (Jordan)
be      Belarusian
is	IS	Icelandic (Iceland)
es	CO	Spanish (Colombia)
es	CR	Spanish (Costa Rica)
es	CL	Spanish (Chile)
ar	EG	Arabic (Egypt)
en	ZA	English (South Africa)
th	TH	Thai (Thailand)
el	GR	Greek (Greece)
it	IT	Italian (Italy)
ca      Catalan
hu	HU	Hungarian (Hungary)
fr      French
en	IE	English (Ireland)
uk	UA	Ukrainian (Ukraine)
pl	PL	Polish (Poland)
fr	LU	French (Luxembourg)
nl	BE	Dutch (Belgium)
en	IN	English (India)
ca	ES	Catalan (Spain)
ar	MA	Arabic (Morocco)
es	BO	Spanish (Bolivia)
en	AU	English (Australia)
sr      Serbian
zh	SG	Chinese (Singapore)
pt      Portuguese
uk      Ukrainian
es	SV	Spanish (El Salvador)
ru	RU	Russian (Russia)
ko	KR	Korean (South Korea)
vi      Vietnamese
ar	DZ	Arabic (Algeria)
vi	VN	Vietnamese (Vietnam)
sr	ME	Serbian (Montenegro)
sq      Albanian
ar	LY	Arabic (Libya)
ar      Arabic
zh	CN	Chinese (China)
be	BY	Belarusian (Belarus)
zh	HK	Chinese (Hong Kong)
ja      Japanese
iw	IL	Hebrew (Israel)
bg	BG	Bulgarian (Bulgaria)
in      Indonesian
mt	MT	Maltese (Malta)
es	PY	Spanish (Paraguay)
sl      Slovenian
fr	FR	French (France)
cs	CZ	čeština (Česká republika)
it	CH	Italian (Switzerland)
ro	RO	Romanian (Romania)
es	PR	Spanish (Puerto Rico)
en	CA	English (Canada)
de	DE	German (Germany)
ga      Irish
de	LU	German (Luxembourg)
de      German
es	AR	Spanish (Argentina)
sk      Slovak
ms	MY	Malay (Malaysia)
hr	HR	Croatian (Croatia)
en	SG	English (Singapore)
da      Danish
mt      Maltese
pl      Polish
ar	OM	Arabic (Oman)
tr      Turkish
th	TH	Thai (Thailand,TH)
el      Greek
ms      Malay
sv	SE	Swedish (Sweden)
da	DK	Danish (Denmark)
es	HN	Spanish (Honduras)

First is language code, second is country code.