Language codes (Definition)

Language codes are used to define locale specific handling.

The Element.lang property controls the locale specific text rendering. It allows special characters to be handled appropriately and special character sets to be supported properly according to the national language variants.

Here is a partial list of some example language codes to be used with it:

CodeLanguageCountry
afAfrikaansStandard
ar_AEArabicU.A.E.
ar_BHArabicBahrain
ar_DZArabicAlgeria
ar_EGArabicEgypt
ar_IQArabicIraq
ar_JOArabicJordan
ar_KWArabicKuwait
ar_LBArabicLebanon
ar_LYArabicLibya
ar_MAArabicMorocco
ar_OMArabicOman
ar_QAArabicQatar
ar_SAArabicSaudi Arabia
ar_SYArabicSyria
ar_TNArabicTunisia
ar_YEArabicYemen
beBelarusianStandard
be_BYBelorussianBelarus
bgBulgarianStandard
bg_BGBulgarianBulgaria
caCatalanStandard
ca_ESCatalanSpain
csCzechStandard
cs_CZCzechCzech Republic
daDanishStandard
da_DKDanishDenmark
deGermanStandard
de_ATGermanAustria
de_CHGermanSwitzerland
de_DEGermanGermany
de_LIGermanLiechtenstein
de_LUGermanLuxembourg
elGreekStandard
el_GRGreekGreece
enEnglishStandard
en_AUEnglishAustralia
en_BZEnglishBelize
en_CAEnglishCanada
en_GBEnglishGreat Britain
en_IEEnglishIreland
en_JMEnglishJamaica
en_NZEnglishNew Zealand
en_TTEnglishTrinidad
en_UKEnglishUnited Kingdom
en_USEnglishUnited States
en_ZAEnglishSouth Africa
esSpanish (Traditional or modern)Spain
es_ARSpanishArgentina
es_BOSpanishBolivia
es_CLSpanishChile
es_COSpanishColombia
es_CRSpanishCosta Rica
es_DOSpanishDominican Republic
es_ECSpanishEcuador
es_ESSpanishSpain
es_GTSpanishGuatemala
es_HNSpanishHonduras
es_MXSpanishMexico
es_NISpanishNicaragua
es_PASpanishPanama
es_PESpanishPeru
es_PRSpanishPuerto Rico
es_PYSpanishParaguay
es_SVSpanishEl Salvador
es_UYSpanishUruguay
es_VESpanishVenezuela
etEstonianStandard
et_EEEstonianEstonia
euBasqueStandard
faFarsiStandard
fiFinnishStandard
fi_FIFinnishFinland
foFaeroeseStandard
frFrenchStandard
fr_BEFrenchBelgium
fr_CAFrenchCanada
fr_CHFrenchSwitzerland
fr_FRFrenchFrance
fr_LUFrenchLuxembourg
gdGaelicScotland
gd_IEGaelicIreland
heHebrewStandard
hiHindiStandard
hrCroatianStandard
hr_HRCroatianCroatia
huHungarianStandard
hu_HUHungarianHungary
inIndonesianStandard
isIcelandicStandard
is_ISIcelandicIceland
itItalianStandard
it_CHItalianSwitzerland
it_ITItalianItaly
iw_ILHebrewIsrael
jaJapaneseStandard
ja_JPJapaneseJapan
jiYiddishStandard
koKoreanJohab
ko_KRKoreanKorea
ltLithuanianStandard
lt_LTLithuanianLithuania
lvLatvianStandard
lv_LVLatvianLatvia
mkMacedonianStandard
mk_MKMacedonianMacedonia
msMalaysianStandard
mtMalteseStandard
nlDutchStandard
nl_BEDutchBelgium
nl_NLDutchNetherlands
noNorwegian (Bokmal or Nynorsk)Standard
no_NO_BNorwegian (Bokmal)Norway
no_NO_NYNorwegian (Nynorsk)Norway
plPolishStandard
pl_PLPolishPoland
ptPortugueseStandard
pt_BRPortugueseBrazil
pt_PTPortuguesePortugal
rmRhaeto-RomanicStandard
roRomanianStandard
ro_MORomanianMoldavia
ro_RORomanianRomania
ruRussianStandard
ru_MORussianMoldavia
ru_RURussianRussia
sbSorbianStandard
sh_SPSerbian (Latin)Serbia
skSlovakStandard
sk_SKSlovakSlovakia
slSlovenianStandard
sl_SISloveneSlovenia
sqAlbanianStandard
sq_ALAlbanianAlbania
srSerbian (Cyrillic)Cyrillic
sr_SPSerbian (Cyrillic)Serbia
svSwedishStandard
sv_FISwedishFinland
sv_SESwedishSweden
sxSutuStandard
szSamiLapland
thThaiStandard
tnTswanaStandard
trTurkishStandard
tr_TRTurkishTurkey
tsTsongaStandard
ukUkrainianStandard
uk_UAUkrainianUkraine
urUrduStandard
veVendaStandard
viVietnameseStandard
xhXhosaStandard
zh_CNChinesePeople's Republic of China
zh_HKChineseHong Kong, S.A.R. China
zh_SGChineseSingapore
zh_TWChineseTaiwan
zuZuluStandard

The language codes are derived from the ISO 639 language standard and the ISO 3166 country codes standard. A language code is an ISO 639 value followed by an underscore and the ISO 3166 value.

The language code is typically presented in lower case while the country code is in upper case, although this is by no means consistent across browsers and platforms.

It is therefore probably safe to assume this value is case-insensitive.

See also:Anchor.hreflang, ISO 3166, LANG="...", LINK.hreflang, Navigator.browserLanguage, Navigator.language, Navigator.systemLanguage, Navigator.userLanguage, Portability, Url.hreflang