com.neovisionaries.i18n
Enum LanguageCode

java.lang.Object
  extended by java.lang.Enum<LanguageCode>
      extended by com.neovisionaries.i18n.LanguageCode
All Implemented Interfaces:
Serializable, Comparable<LanguageCode>

public enum LanguageCode
extends Enum<LanguageCode>

ISO 639-1 language code.

Enum names of this enum themselves are represented by ISO 639-1 code (2-letter lower-case alphabets).

 // List all the language codes.
 for (LanguageCode code : LanguageCode.values())
 {
     // For example, "[ar] Arabic" is printed.
     System.out.format("[%s] %s\n", code, code.getName());
 }

 // Get a LanguageCode instance by ISO 639-1 code.
 LanguageCode code = LanguageCode.getByCode("fr");

 // Convert to a Locale instance.
 Locale locale = code.toLocale();

 // Get a LanguageCode by a Locale instance.
 code = LanguageCode.getByLocale(locale);
 

Author:
Takahiko Kawasaki

Enum Constant Summary
aa
          Afar (aar).
ab
          Abkhaz (abk).
ae
          Avestan (ave).
af
          Afrikaans (afr).
ak
          Akan (aka).
am
          Amharic (amh).
an
          Aragonese (arg).
ar
          Arabic (ara).
as
          Assamese (asm).
av
          Avaric (ava).
ay
          Aymara (aym).
az
          Azerbaijani (aze).
ba
          Bashkir (bak).
be
          Belarusian (bel).
bg
          Bulgarian (bul).
bh
          Bihari (bih).
bi
          Bislama (bis).
bm
          Bambara (bam).
bn
          Bengali (ben).
bo
          Tibetan (bod, tib).
br
          Breton (bre).
bs
          Bosnian (bos).
ca
          Catalan (cat).
ce
          Chechen (che).
ch
          Chamorro (cha).
co
          Corsican (cos).
cr
          Cree (cre).
cs
          Czech (ces, cze).
cu
          Church Slavonic (chu).
cv
          Chuvash (chv).
cy
          Welsh (cym, wel).
da
          Danish (dan).
de
          German (deu, ger).
dv
          Dhivehi (div).
dz
          Dzongkha (dzo).
ee
          Ewe (ewe).
el
          Greek (ell, gre).
en
          English (eng).
eo
          Esperanto (epo).
es
          Spanish (spa).
et
          Estonian (est).
eu
          Basque (eus, baq).
fa
          Persian (fas, per).
ff
          Fula (ful).
fi
          Finnish (fin).
fj
          Fijian (fij).
fo
          Faroese (fao).
fr
          French (fra, fre).
fy
          West Frisian (fry).
ga
          Irish (gle).
gd
          Scottish Gaelic (gla).
gl
          Galician (glg).
gn
          Guaraní (grn).
gu
          Gujarati (guj).
gv
          Manx (glv).
ha
          Hausa (hau).
he
          Hebrew (heb).
hi
          Hindi (hin).
ho
          Hiri Motu (hmo).
hr
          Croatian (hrv).
ht
          Haitian (hat).
hu
          Hungarian (hun).
hy
          Armenian (hye, arm).
hz
          Herero (her).
ia
          Interlingua (ina).
id
          Indonesian (ind).
ie
          Interlingue (ile).
ig
          Igbo (ibo).
ii
          Nuosu (iii).
ik
          Inupiaq (ipk).
io
          Ido (ido).
is
          Icelandic (isl, ice).
it
          Italian (ita).
iu
          Inuktitut (iku).
ja
          Japanese (jpn).
jv
          Javanese (jav).
ka
          Georgian (kat, geo).
kg
          Kongo (kon).
ki
          Kikuyu (kik).
kj
          Kwanyama (kua).
kk
          Kazakh (kaz).
kl
          Kalaallisut (kal).
km
          Khmer (khm).
kn
          Kannada (kan).
ko
          Korean (kor).
kr
          Kanuri (kau).
ks
          Kashmiri (kas).
ku
          Kurdish (kur).
kv
          Komi (kom).
kw
          Cornish (cor).
ky
          Kyrgyz (kir).
la
          Latin (lat).
lb
          Luxembourgish (ltz).
lg
          Ganda (lug).
li
          Limburgish (lim).
ln
          Lingala (lin).
lo
          Lao (lao).
lt
          Lithuanian (lit).
lu
          Luba-Katanga (lub).
lv
          Latvian (lav).
mg
          Malagasy (mlg).
mh
          Marshallese (mah).
mi
          Māori (mir, mao).
mk
          Macedonian (mkd, mac)).
ml
          Malayalam (mal).
mn
          Mongolian (mon).
mr
          Marathi (mar).
ms
          Malay (msa, may).
mt
          Maltese (mlt).
my
          Burmese (may, bur).
na
          Nauru (nau).
nb
          Norwegian Bokmål (nob).
nd
          Northern Ndebele (nde).
ne
          Nepali (nep).
ng
          Ndonga (ndo).
nl
          Dutch (nld, dut).
nn
          Norwegian Nynorsk (nno).
no
          Norwegian (nor).
nr
          Southern Ndebele (nbl).
nv
          Navajo (nav).
ny
          Chichewa (nya).
oc
          Occitan (oci).
oj
          Ojibwe (oji).
om
          Oromo (orm).
or
          Oriya (ori).
os
          Ossetian (oss).
pa
          Punjabi (pan).
pi
          Pāli (pli).
pl
          Polish (pol).
ps
          Pashto (pus).
pt
          Portuguese (por).
qu
          Quechua (que).
rm
          Romansh (roh).
rn
          Kirundi (run).
ro
          Romanian (ron, rum).
ru
          Russian (run).
rw
          Kinyarwanda (kin).
sa
          Sanskrit (san).
sc
          Sardinian (srd).
sd
          Sindhi (snd).
se
          Northern Sami (sme).
sg
          Sango (sag).
si
          Sinhala (sin).
sk
          Slovak (slk, slo).
sl
          Slovene (slv).
sm
          Samoan (smo).
sn
          Shona (sna).
so
          Somali (som).
sq
          Albanian (sqi, alb).
sr
          Serbian (srp).
ss
          Swati (ssw).
st
          Southern Sotho (sot).
su
          Sundanese (sun).
sv
          Swedish (swe).
sw
          Swahili (swa).
ta
          Tamil (tam).
te
          Telugu (tel).
tg
          Tajik (tgk).
th
          Thai (tha).
ti
          Tigrinya (tir).
tk
          Turkmen (tuk).
tl
          Tagalog (tgl).
tn
          Tswana (tsn).
to
          Tongan (ton).
tr
          Turkish (tur).
ts
          Tsonga (tso).
tt
          Tatar (tat).
tw
          Twi (twi).
ty
          Tahitian (tah).
ug
          Uighur (uig).
uk
          Ukrainian (ukr).
ur
          Urdu (urd).
uz
          Uzbek (uzb).
ve
          Venda (ven).
vi
          Vietnamese (vie).
vo
          Volapük (vol).
wa
          Walloon (wln).
wo
          Wolof (wol).
xh
          Xhosa (xho).
yi
          Yiddish (yid).
yo
          Yoruba (yor).
za
          Zhuang (zha).
zh
          Chinese (zho, chi).
zu
          Zulu (zul).
 
Method Summary
 LanguageAlpha3Code getAlpha3()
          Get ISO 639-2 language code (3-letter lowercase code(s)).
static LanguageCode getByCode(String code)
          Get a LanguageCode that corresponds to a given ISO 639-1 code (2-letter lowercase code) or ISO 639-2 code (3-letter lowercase code).
static LanguageCode getByCode(String code, boolean caseSensitive)
          Get a LanguageCode that corresponds to a given ISO 639-1 code (2-letter lowercase code) or ISO 639-2 code (3-letter lowercase code).
static LanguageCode getByLocale(Locale locale)
          Get a LanguageCode that corresponds to the language code of the given Locale instance.
 String getName()
          Get the language name.
 Locale toLocale()
          Convert this LanguageCode instance to a Locale instance.
static LanguageCode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static LanguageCode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

aa

public static final LanguageCode aa
Afar (aar).


ab

public static final LanguageCode ab
Abkhaz (abk).


ae

public static final LanguageCode ae
Avestan (ave).


af

public static final LanguageCode af
Afrikaans (afr).


ak

public static final LanguageCode ak
Akan (aka).


am

public static final LanguageCode am
Amharic (amh).


an

public static final LanguageCode an
Aragonese (arg).


ar

public static final LanguageCode ar
Arabic (ara).


as

public static final LanguageCode as
Assamese (asm).


av

public static final LanguageCode av
Avaric (ava).


ay

public static final LanguageCode ay
Aymara (aym).


az

public static final LanguageCode az
Azerbaijani (aze).


ba

public static final LanguageCode ba
Bashkir (bak).


be

public static final LanguageCode be
Belarusian (bel).


bg

public static final LanguageCode bg
Bulgarian (bul).


bh

public static final LanguageCode bh
Bihari (bih).


bi

public static final LanguageCode bi
Bislama (bis).


bm

public static final LanguageCode bm
Bambara (bam).


bn

public static final LanguageCode bn
Bengali (ben).


bo

public static final LanguageCode bo
Tibetan (bod, tib).


br

public static final LanguageCode br
Breton (bre).


bs

public static final LanguageCode bs
Bosnian (bos).


ca

public static final LanguageCode ca
Catalan (cat).


ce

public static final LanguageCode ce
Chechen (che).


ch

public static final LanguageCode ch
Chamorro (cha).


co

public static final LanguageCode co
Corsican (cos).


cr

public static final LanguageCode cr
Cree (cre).


cs

public static final LanguageCode cs
Czech (ces, cze).


cu

public static final LanguageCode cu
Church Slavonic (chu).


cv

public static final LanguageCode cv
Chuvash (chv).


cy

public static final LanguageCode cy
Welsh (cym, wel).


da

public static final LanguageCode da
Danish (dan).


de

public static final LanguageCode de
German (deu, ger).


dv

public static final LanguageCode dv
Dhivehi (div).


dz

public static final LanguageCode dz
Dzongkha (dzo).


ee

public static final LanguageCode ee
Ewe (ewe).


el

public static final LanguageCode el
Greek (ell, gre).


en

public static final LanguageCode en
English (eng).


eo

public static final LanguageCode eo
Esperanto (epo).


es

public static final LanguageCode es
Spanish (spa).


et

public static final LanguageCode et
Estonian (est).


eu

public static final LanguageCode eu
Basque (eus, baq).


fa

public static final LanguageCode fa
Persian (fas, per).


ff

public static final LanguageCode ff
Fula (ful).


fi

public static final LanguageCode fi
Finnish (fin).


fj

public static final LanguageCode fj
Fijian (fij).


fo

public static final LanguageCode fo
Faroese (fao).


fr

public static final LanguageCode fr
French (fra, fre).


fy

public static final LanguageCode fy
West Frisian (fry).


ga

public static final LanguageCode ga
Irish (gle).


gd

public static final LanguageCode gd
Scottish Gaelic (gla).


gl

public static final LanguageCode gl
Galician (glg).


gn

public static final LanguageCode gn
Guaraní (grn).


gu

public static final LanguageCode gu
Gujarati (guj).


gv

public static final LanguageCode gv
Manx (glv).


ha

public static final LanguageCode ha
Hausa (hau).


he

public static final LanguageCode he
Hebrew (heb).


hi

public static final LanguageCode hi
Hindi (hin).


ho

public static final LanguageCode ho
Hiri Motu (hmo).


hr

public static final LanguageCode hr
Croatian (hrv).


ht

public static final LanguageCode ht
Haitian (hat).


hu

public static final LanguageCode hu
Hungarian (hun).


hy

public static final LanguageCode hy
Armenian (hye, arm).


hz

public static final LanguageCode hz
Herero (her).


ia

public static final LanguageCode ia
Interlingua (ina).


id

public static final LanguageCode id
Indonesian (ind).


ie

public static final LanguageCode ie
Interlingue (ile).


ig

public static final LanguageCode ig
Igbo (ibo).


ii

public static final LanguageCode ii
Nuosu (iii).


ik

public static final LanguageCode ik
Inupiaq (ipk).


io

public static final LanguageCode io
Ido (ido).


is

public static final LanguageCode is
Icelandic (isl, ice).


it

public static final LanguageCode it
Italian (ita).


iu

public static final LanguageCode iu
Inuktitut (iku).


ja

public static final LanguageCode ja
Japanese (jpn).


jv

public static final LanguageCode jv
Javanese (jav).


ka

public static final LanguageCode ka
Georgian (kat, geo).


kg

public static final LanguageCode kg
Kongo (kon).


ki

public static final LanguageCode ki
Kikuyu (kik).


kj

public static final LanguageCode kj
Kwanyama (kua).


kk

public static final LanguageCode kk
Kazakh (kaz).


kl

public static final LanguageCode kl
Kalaallisut (kal).


km

public static final LanguageCode km
Khmer (khm).


kn

public static final LanguageCode kn
Kannada (kan).


ko

public static final LanguageCode ko
Korean (kor).


kr

public static final LanguageCode kr
Kanuri (kau).


ks

public static final LanguageCode ks
Kashmiri (kas).


ku

public static final LanguageCode ku
Kurdish (kur).


kv

public static final LanguageCode kv
Komi (kom).


kw

public static final LanguageCode kw
Cornish (cor).


ky

public static final LanguageCode ky
Kyrgyz (kir).


la

public static final LanguageCode la
Latin (lat).


lb

public static final LanguageCode lb
Luxembourgish (ltz).


lg

public static final LanguageCode lg
Ganda (lug).


li

public static final LanguageCode li
Limburgish (lim).


ln

public static final LanguageCode ln
Lingala (lin).


lo

public static final LanguageCode lo
Lao (lao).


lt

public static final LanguageCode lt
Lithuanian (lit).


lu

public static final LanguageCode lu
Luba-Katanga (lub).


lv

public static final LanguageCode lv
Latvian (lav).


mg

public static final LanguageCode mg
Malagasy (mlg).


mh

public static final LanguageCode mh
Marshallese (mah).


mi

public static final LanguageCode mi
Māori (mir, mao).


mk

public static final LanguageCode mk
Macedonian (mkd, mac)).


ml

public static final LanguageCode ml
Malayalam (mal).


mn

public static final LanguageCode mn
Mongolian (mon).


mr

public static final LanguageCode mr
Marathi (mar).


ms

public static final LanguageCode ms
Malay (msa, may).


mt

public static final LanguageCode mt
Maltese (mlt).


my

public static final LanguageCode my
Burmese (may, bur).


na

public static final LanguageCode na
Nauru (nau).


nb

public static final LanguageCode nb
Norwegian Bokmål (nob).


nd

public static final LanguageCode nd
Northern Ndebele (nde).


ne

public static final LanguageCode ne
Nepali (nep).


ng

public static final LanguageCode ng
Ndonga (ndo).


nl

public static final LanguageCode nl
Dutch (nld, dut).


nn

public static final LanguageCode nn
Norwegian Nynorsk (nno).


no

public static final LanguageCode no
Norwegian (nor).


nr

public static final LanguageCode nr
Southern Ndebele (nbl).


nv

public static final LanguageCode nv
Navajo (nav).


ny

public static final LanguageCode ny
Chichewa (nya).


oc

public static final LanguageCode oc
Occitan (oci).


oj

public static final LanguageCode oj
Ojibwe (oji).


om

public static final LanguageCode om
Oromo (orm).


or

public static final LanguageCode or
Oriya (ori).


os

public static final LanguageCode os
Ossetian (oss).


pa

public static final LanguageCode pa
Punjabi (pan).


pi

public static final LanguageCode pi
Pāli (pli).


pl

public static final LanguageCode pl
Polish (pol).


ps

public static final LanguageCode ps
Pashto (pus).


pt

public static final LanguageCode pt
Portuguese (por).


qu

public static final LanguageCode qu
Quechua (que).


rm

public static final LanguageCode rm
Romansh (roh).


rn

public static final LanguageCode rn
Kirundi (run).


ro

public static final LanguageCode ro
Romanian (ron, rum).


ru

public static final LanguageCode ru
Russian (run).


rw

public static final LanguageCode rw
Kinyarwanda (kin).


sa

public static final LanguageCode sa
Sanskrit (san).


sc

public static final LanguageCode sc
Sardinian (srd).


sd

public static final LanguageCode sd
Sindhi (snd).


se

public static final LanguageCode se
Northern Sami (sme).


sg

public static final LanguageCode sg
Sango (sag).


si

public static final LanguageCode si
Sinhala (sin).


sk

public static final LanguageCode sk
Slovak (slk, slo).


sl

public static final LanguageCode sl
Slovene (slv).


sm

public static final LanguageCode sm
Samoan (smo).


sn

public static final LanguageCode sn
Shona (sna).


so

public static final LanguageCode so
Somali (som).


sq

public static final LanguageCode sq
Albanian (sqi, alb).


sr

public static final LanguageCode sr
Serbian (srp).


ss

public static final LanguageCode ss
Swati (ssw).


st

public static final LanguageCode st
Southern Sotho (sot).


su

public static final LanguageCode su
Sundanese (sun).


sv

public static final LanguageCode sv
Swedish (swe).


sw

public static final LanguageCode sw
Swahili (swa).


ta

public static final LanguageCode ta
Tamil (tam).


te

public static final LanguageCode te
Telugu (tel).


tg

public static final LanguageCode tg
Tajik (tgk).


th

public static final LanguageCode th
Thai (tha).


ti

public static final LanguageCode ti
Tigrinya (tir).


tk

public static final LanguageCode tk
Turkmen (tuk).


tl

public static final LanguageCode tl
Tagalog (tgl).


tn

public static final LanguageCode tn
Tswana (tsn).


to

public static final LanguageCode to
Tongan (ton).


tr

public static final LanguageCode tr
Turkish (tur).


ts

public static final LanguageCode ts
Tsonga (tso).


tt

public static final LanguageCode tt
Tatar (tat).


tw

public static final LanguageCode tw
Twi (twi).


ty

public static final LanguageCode ty
Tahitian (tah).


ug

public static final LanguageCode ug
Uighur (uig).


uk

public static final LanguageCode uk
Ukrainian (ukr).


ur

public static final LanguageCode ur
Urdu (urd).


uz

public static final LanguageCode uz
Uzbek (uzb).


ve

public static final LanguageCode ve
Venda (ven).


vi

public static final LanguageCode vi
Vietnamese (vie).


vo

public static final LanguageCode vo
Volapük (vol).


wa

public static final LanguageCode wa
Walloon (wln).


wo

public static final LanguageCode wo
Wolof (wol).


xh

public static final LanguageCode xh
Xhosa (xho).


yi

public static final LanguageCode yi
Yiddish (yid).


yo

public static final LanguageCode yo
Yoruba (yor).


za

public static final LanguageCode za
Zhuang (zha).


zh

public static final LanguageCode zh
Chinese (zho, chi).


zu

public static final LanguageCode zu
Zulu (zul).

Method Detail

values

public static LanguageCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (LanguageCode c : LanguageCode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static LanguageCode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getName

public String getName()
Get the language name.

Returns:
The language name.

toLocale

public Locale toLocale()
Convert this LanguageCode instance to a Locale instance.

In most cases, this method creates a new Locale instance every time it is called, but some LanguageCode instances return their corresponding entries in Locale class. For example, LanguageCode.ja always returns Locale.JAPANESE.

The table below lists LanguageCode entries whose toLocale() do not create new Locale instances but return entries in Locale class.

LanguageCode Locale
LanguageCode.de Locale.GERMAN
LanguageCode.en Locale.ENGLISH
LanguageCode.fr Locale.FRENCH
LanguageCode.it Locale.ITALIAN
LanguageCode.ja Locale.JAPANESE
LanguageCode.ko Locale.KOREAN
LanguageCode.zh Locale.CHINESE

Returns:
A Locale instance that matches this LanguageCode.

getAlpha3

public LanguageAlpha3Code getAlpha3()
Get ISO 639-2 language code (3-letter lowercase code(s)).

Most languages have just one corresponding ISO 639-2 code, but some languages have two ISO 639-2 codes. They are known as "bibliographic" code (ISO 639-2/B code) and "terminological" code (ISO 639-2/T code). This method returns ISO 639-2/T code. If you want to get ISO 639-2/B code, write like below.


 LanguageCode alpha2 = ...;

 LanguageAlpha3Code alpha3B = alpha2.getAlpha3().getAlpha3B();
 

The above code does no harm for most LanguageCodes that have just one ISO 639-2 code. getAlpha3B() of such LanguageAlpha3Code instances just return themselves (= this object).

The table below lists languages having two ISO 639-2 codes.

ISO 639-1 ISO 639-2/T ISO 639-2/B Language
bo bod tib Tibetan
eu eus baq Basque
cs ces cze Czech
cy cym wel Welsh
de deu ger German
el ell gre Greek
fa fas per Persian
fr fra fre French
hy hye arm Armenian
is isl ice Icelandic
ka kat geo Georgian
mi mri mao Māori
mk mkd mac Macedonian
ms msa may Malay
my mya bur Burmese
nl nld dut Dutch
ro ron rum Romanian
sk slk slo Slovak
sq sqi alb Albanian

Returns:
ISO 639-2 language code.
Since:
1.1

getByCode

public static LanguageCode getByCode(String code)
Get a LanguageCode that corresponds to a given ISO 639-1 code (2-letter lowercase code) or ISO 639-2 code (3-letter lowercase code).

This method calls getByCode(code, false), meaning the case of the given code is ignored.

Parameters:
code - An ISO 639-1 code (2-letter lowercase code) or an ISO 639-2 code (3-letter lowercase code). Note that if the given code is one of legacy language codes ("iw", "ji" and "in"), it is treated as its official counterpart ("he", "yi" and "id", respectively). For example, if "in" is given, this method returns LanguageCode.id.
Returns:
A LanguageCode instance, or null if not found.

getByCode

public static LanguageCode getByCode(String code,
                                     boolean caseSensitive)
Get a LanguageCode that corresponds to a given ISO 639-1 code (2-letter lowercase code) or ISO 639-2 code (3-letter lowercase code).

Parameters:
code - An ISO 639-1 code (2-letter lowercase code) or an ISO 639-2 code (3-letter lowercase code). Note that if the given code is one of legacy language codes ("iw", "ji" and "in"), it is treated as its official counterpart ("he", "yi" and "id", respectively). For example, if "in" is given, this method returns LanguageCode.id.
caseSensitive - If true, the given code should consist of lowercase letters only. If false, this method internally canonicalizes the given code by String.toLowerCase() and then performs search. For example, getByCode("JA", true) returns null, but on the other hand, getByCode("JA", false) returns LanguageCode.ja.
Returns:
A LanguageCode instance, or null if not found.

getByLocale

public static LanguageCode getByLocale(Locale locale)
Get a LanguageCode that corresponds to the language code of the given Locale instance.

Parameters:
locale - A Locale instance.
Returns:
A LanguageCode instance, or null if not found.
See Also:
Locale.getLanguage()


Copyright © 2013. All Rights Reserved.