Module:Lang/langx
This Lua module is used on a very large number of pages. To avoid large-scale disruption and unnecessary server load, any changes to this module should first be tested in its /sandbox or /testcases subpages. The tested changes can then be added to this page in one single edit. Please consider discussing any changes on the talk page before implementing them. |
--[[--------------------------< I N H E R I T _ T >------------------------------------------------------------
table of language tags that render text in an upright font; all others are rendered in an italic font
Data in this table scraped from {{lang-xx}} templates
keys (tags) in this table must be lowercase.
TODO: in the long run, do we need this table? Can't {{langx}} auto-italicize in some fashon similar to {{lang}}?
]]
local inherit_t = {
----------< I S O 6 3 9 - 1 >----------
['ab'] = true,
['ae'] = true,
['am'] = true,
['ar'] = true,
['as'] = true,
['av'] = true,
['ba'] = true,
['be'] = true,
['bg'] = true,
['bh'] = true,
['bn'] = true,
['bo'] = true,
['ce'] = true,
['cr'] = true,
['cu'] = true,
['cv'] = true,
['dv'] = true,
['dz'] = true,
['el'] = true,
['en'] = true,
['fa'] = true,
['gu'] = true,
['he'] = true,
['hi'] = true,
['hy'] = true,
['ii'] = true,
['iu'] = true,
['ja'] = true,
['jv'] = true,
['kk'] = true,
['km'] = true,
['kn'] = true,
['ko'] = true,
['kr'] = true,
['ks'] = true,
['ku'] = true,
['kv'] = true,
['ky'] = true,
['lo'] = true,
['mk'] = true,
['ml'] = true,
['mn'] = true,
['mr'] = true,
['my'] = true,
['ne'] = true,
['or'] = true,
['os'] = true,
['pa'] = true,
['pi'] = true,
['ps'] = true,
['ru'] = true,
['sa'] = true,
['sd'] = true,
['si'] = true,
['sr'] = true,
['su'] = true,
['ta'] = true,
['te'] = true,
['tg'] = true,
['th'] = true,
['ti'] = true,
['tt'] = true,
['ug'] = true,
['uk'] = true,
['ur'] = true,
['uz'] = true,
['yi'] = true,
['za'] = true,
['zh'] = true, -- included here because there are other templates (infobox forest, etc) that assemble calls to {{langx|<tag>}} where <tag> is 'zh'
----------< I S O 6 3 9 - 1 R E D I R E C T S >----------
-- these to be removed as soon as possible
['abk'] = true, -- ab
['ave'] = true, -- ae
['amh'] = true, -- am
['ara'] = true, -- ar
['ar-at'] = true, -- ar
['as1'] = true, -- as
-- ['assamese1'] = true, -- as; invalid, not an IANA variant
['asm'] = true, -- as
['ava'] = true, -- av
['bak'] = true, -- ba
['bel'] = true, -- be
['bul '] = true, -- bg
['bih'] = true, -- bh
-- ['bengali1'] = true, -- bn; invalid, not an IANA variant
-- ['bengali'] = true, -- bn; invalid, not an IANA variant
['ben'] = true, -- bn
['bo1'] = true, -- bo
['bod'] = true, -- bo
['tib'] = true, -- bo
['che'] = true, -- ce
['cre'] = true, -- cr
['chu'] = true, -- cu
['chv'] = true, -- cv
-- ['mahal'] = true, -- dv; invalid, not an IANA variant
['dmh'] = true, -- dv
['div'] = true, -- dv
['dzo'] = true, -- dz
['gr'] = true, -- el
['ell'] = true, -- el
['gre'] = true, -- el
['fa-at'] = true, -- fa
-- ['persian'] = true, -- fa; invalid, not an IANA variant
['fas'] = true, -- fa
['per'] = true, -- fa
['guj'] = true, -- gu
['he1'] = true, -- he; also has redirect 'He' without 'Lang-' prefix; not supported by langx
['iw'] = true, -- he
['heb'] = true, -- he
['hi1'] = true, -- hi
-- ['hindi1'] = true, -- hi; invalid, not an IANA variant
-- ['hindi'] = true, -- hi; invalid, not an IANA variant
['hin'] = true, -- hi
['arm'] = true, -- hy
['hye'] = true, -- hy
['iii'] = true, -- ii
['iku'] = true, -- iu
['jpn'] = true, -- ja
['jw'] = true, -- jv
['jav'] = true, -- jv
['kz'] = true, -- kk
['kk-cyrl'] = true, -- kk
['kaz'] = true, -- kk
['khm'] = true, -- km
['kan'] = true, -- kn
['kor'] = true, -- ko
['kau'] = true, -- kr
['kas'] = true, -- ks
['kur'] = true, -- ku
['kom'] = true, -- kv
['kpv'] = true, -- kv
['kir'] = true, -- ky
['lao'] = true, -- lo
['mkd'] = true, -- mk
['mac'] = true, -- mk
['mal'] = true, -- ml
['mon'] = true, -- mn
['mar'] = true, -- mr
['mya'] = true, -- my
['bur'] = true, -- my
['nep'] = true, -- ne
['od'] = true, -- or
['ori'] = true, -- or
['or'] = true, -- or
['pan'] = true, -- pa
['pli'] = true, -- pi
['pus'] = true, -- ps
-- ['ru'] = true, -- ru; no redirects
['sa1'] = true, -- sa; also has redirect 'San' without 'Lang-' prefix; not supported by langx
['san'] = true, -- sa
-- ['sindhi1'] = true, -- sd; invalid, not an IANA variant
['snd'] = true, -- sd
['sin'] = true, -- si
['srp'] = true, -- sr
['scc'] = true, -- sr
['sun'] = true, -- su
['tam'] = true, -- ta
['tel'] = true, -- te; also has redirect 'Te' without 'Lang-' prefix; not supported by langx
['tgk'] = true, -- tg
['tha'] = true, -- th; also has redirects 'Th-lang' and 'Thai' without 'Lang-' prefix; not supported by langx
['tir'] = true, -- ti
['tat'] = true, -- tt
['ug3'] = true, -- ug; also has redirects 'Ug' and 'Uyghur' without 'Lang-' prefix; not supported by langx
['uy'] = true, -- ug
['uig'] = true, -- ug
['ua'] = true, -- uk
['ukr'] = true, -- uk
-- ['urdu1'] = true, -- ur; invalid, not an IANA variant
['urd'] = true, -- ur
['uzb'] = true, -- uz
['yi1'] = true, -- yi
['ji'] = true, -- yi
['yid'] = true, -- yi
['zha'] = true, -- za
----------< I S O 6 3 9 - 2 , - 3 >----------
['aaq'] = true,
['abq'] = true,
['acm'] = true,
['acw'] = true,
['ady'] = true,
['aeb'] = true,
['aec'] = true,
['afb'] = true,
['aii'] = true,
['aij'] = true,
['ain'] = true,
['aiq'] = true,
['ajp'] = true,
['akk'] = true,
['alt'] = true,
['amw'] = true,
['apc'] = true,
['apm'] = true,
['apw'] = true,
['arb'] = true,
['arc'] = true,
['arq'] = true,
['ary'] = true,
['arz'] = true,
['axm'] = true,
['ayn'] = true,
['azb'] = true,
['bal'] = true,
['ban'] = true,
['bdz'] = true,
['bej'] = true,
['ber'] = true,
['bft'] = true,
['bgn'] = true,
['bho'] = true,
['bla'] = true,
['blk'] = true,
['bpy'] = true,
['bqi'] = true,
['brh'] = true,
['brx'] = true,
['bsk'] = true,
['bua'] = true,
['bug'] = true,
['bxr'] = true,
['ccp'] = true,
['cdo'] = true,
['chg'] = true,
['chm'] = true,
['chr'] = true,
['cjs'] = true,
['ckb'] = true,
['ckt'] = true,
['cld'] = true,
['cmn'] = true,
['cnr'] = true,
['cop'] = true,
['cpg'] = true,
['crg'] = true,
['crh'] = true,
['crj'] = true,
['crl'] = true,
['ctg'] = true,
['cwd'] = true,
['dar'] = true,
['ddo'] = true,
['deh'] = true,
['del'] = true,
['dev'] = true,
['dgo'] = true,
['dlg'] = true,
['dng'] = true,
['elx'] = true,
['enf'] = true,
['enh'] = true,
['eve'] = true,
['evn'] = true,
['fuc'] = true,
['gay'] = true,
['gbm'] = true,
['gbz'] = true,
['gez'] = true,
['gju'] = true,
['glk'] = true,
['gmy'] = true,
['got'] = true,
['grc'] = true,
['grm'] = true,
['hac'] = true,
['hak'] = true,
['haz'] = true,
['hbo'] = true,
['hif'] = true,
['him'] = true,
['hit'] = true,
['hlu'] = true,
['hnd'] = true,
['hno'] = true,
['hoc'] = true,
['hyw'] = true,
['inh'] = true,
['iow'] = true,
['itl'] = true,
['jdt'] = true,
['jog'] = true,
['jpa'] = true,
['jrb'] = true,
['jur'] = true,
['jye'] = true,
['kaa'] = true,
['kab'] = true,
['kac'] = true,
['kbd'] = true,
['kca'] = true,
['kha'] = true,
['khb'] = true,
['khw'] = true,
['kiq'] = true,
['kjp'] = true,
['kjz'] = true,
['kkh'] = true,
['kls'] = true,
['knn'] = true,
['koi'] = true,
['kok'] = true,
['krc'] = true,
['ksw'] = true,
['kum'] = true,
['kvx'] = true,
['lbe'] = true,
['lbj'] = true,
['lez'] = true,
['lis'] = true,
['ljp'] = true,
['lrc'] = true,
['lss'] = true,
['lui'] = true,
['luz'] = true,
['lzz'] = true,
['mai'] = true,
['mak'] = true,
['mdf'] = true,
['mey'] = true,
['mfp'] = true,
['mhr'] = true,
['mid'] = true,
['mis'] = true,
['mjw'] = true,
['mjy'] = true,
['mki'] = true,
['mni'] = true,
['mnj'] = true,
['mns'] = true,
['mnw'] = true,
['mrh'] = true,
['mrj'] = true,
['mrv'] = true,
['mul'] = true,
['mvi'] = true,
['mwr'] = true,
['myv'] = true,
['myz'] = true,
['mzb'] = true,
['mzn'] = true,
['nan'] = true,
['naz'] = true,
['new'] = true,
['nio'] = true,
['nlm'] = true,
['nod'] = true,
['nog'] = true,
['nqo'] = true,
['nsd'] = true,
['nsk'] = true,
['nwc'] = true,
['nxm'] = true,
['oaa'] = true,
['oar'] = true,
['oav'] = true,
['obm'] = true,
['och'] = true,
['oge'] = true,
['okm'] = true,
['omp'] = true,
['omy'] = true,
['oru'] = true,
['orv'] = true,
['osa'] = true,
['ota'] = true,
['otb'] = true,
['otk'] = true,
['oty'] = true,
['pal'] = true,
['pao'] = true,
['peo'] = true,
['pes'] = true,
['pgd'] = true,
['phn'] = true,
['phr'] = true,
['pka'] = true,
['pmh'] = true,
['pnb'] = true,
['pnt'] = true,
['pra'] = true,
['prg'] = true,
['prs'] = true,
['prx'] = true,
['psu'] = true,
['pwo'] = true,
['qua'] = true,
['raj'] = true,
['rej'] = true,
['rif'] = true,
['rki'] = true,
['rkt'] = true,
['rmz'] = true,
['rob'] = true,
['rsk'] = true,
['rue'] = true,
['rut'] = true,
['rys'] = true,
['ryu'] = true,
['sac'] = true,
['sah'] = true,
['sat'] = true,
['saz'] = true,
['sbn'] = true,
['scl'] = true,
['sdh'] = true,
['sel'] = true,
['ser'] = true,
['sgh'] = true,
['shh'] = true,
['shi'] = true,
['shn'] = true,
['sia'] = true,
['sip'] = true,
['siz'] = true,
['sjd'] = true,
['sjn'] = true,
['sjo'] = true,
['skr'] = true,
['sla'] = true,
['slr'] = true,
['smi'] = true,
['sog'] = true,
['sou'] = true,
['sqo'] = true,
['sqr'] = true,
['srh'] = true,
['str'] = true,
['sty'] = true,
['sux'] = true,
['sva'] = true,
['syc'] = true,
['syl'] = true,
['syr'] = true,
['tab'] = true,
['tao'] = true,
['tcy'] = true,
['tdd'] = true,
['tig'] = true,
['tly'] = true,
['tmr'] = true,
['tom'] = true,
['tru'] = true,
['tts'] = true,
['ttt'] = true,
['tyv'] = true,
['tzm'] = true,
['uby'] = true,
['ude'] = true,
['udm'] = true,
['uga'] = true,
['und'] = true,
['uum'] = true,
['wal'] = true,
['wam'] = true,
['wbl'] = true,
['wne'] = true,
['xaa'] = true,
['xal'] = true,
['xbc'] = true,
['xcl'] = true,
['xcr'] = true,
['xct'] = true,
['xdc'] = true,
['xdm'] = true,
['xhe'] = true,
['xhu'] = true,
['xlc'] = true,
['xld'] = true,
['xlu'] = true,
['xmf'] = true,
['xna'] = true,
['xng'] = true,
['xpr'] = true,
['xpu'] = true,
['xqa'] = true,
['xsr'] = true,
['xur'] = true,
['xwo'] = true,
['ydg'] = true,
['ykg'] = true,
['yoi'] = true,
['yrk'] = true,
['yue'] = true,
['zgh'] = true,
['zxx'] = true,
----------< I E T F >----------
['akk-x-latbabyl'] = true,
['akk-x-midassyr'] = true,
['akk-x-midbabyl'] = true,
['akk-x-neoassyr'] = true,
['akk-x-neobabyl'] = true,
['akk-x-oldassyr'] = true,
['akk-x-oldbabyl'] = true,
['az-arab'] = true,
['az-cyrl'] = true,
['bs-cyrl'] = true,
['cnr-cyrl'] = true,
['en-emodeng'] = true,
['grc-x-aeolic'] = true,
['grc-x-attic'] = true,
['grc-x-biblical'] = true,
['grc-x-classic'] = true,
['grc-x-doric'] = true,
['grc-x-hellen'] = true,
['grc-x-ionic'] = true,
['grc-x-koine'] = true,
['grc-x-medieval'] = true,
['grc-x-patris'] = true,
['grk-x-proto'] = true,
['ku-cyrl'] = true,
['ms-arab'] = true,
['ro-md'] = true,
['ro-cyrl-md'] = true,
['tk-cyrl'] = true,
['tt-arab'] = true,
['tt-cyrl'] = true,
['uz-cyrl'] = true,
['xal-ru'] = true;
}
--[[--------------------------< R T L _ T >--------------------------------------------------------------------
table of language tags that render text right-to-left
Data in this table scraped from {{lang-xx}} templates that set |rtl=yes
keys (tags) in this table must be lowercase.
TODO: in the long run, do we need this table? Can't {{langx}} apply dir="rtl" attribute automatically?
]]
local rtl_t = {
----------< I S O 6 3 9 - 1 >----------
['ae'] = true,
['ar'] = true,
['fa'] = true,
['he'] = true,
['ku'] = true,
['ps'] = true,
['sd'] = true,
['ur'] = true,
['yi'] = true,
----------< I S O 6 3 9 - 2 , - 3 >----------
['acm'] = true,
['aeb'] = true,
['aec'] = true,
['afb'] = true,
['aii'] = true,
['aij'] = true,
['aiq'] = true,
['ajp'] = true,
['amw'] = true,
['apc'] = true,
['arb'] = true,
['arc'] = true,
['arq'] = true,
['ary'] = true,
['arz'] = true,
['ayn'] = true,
['bal'] = true,
['bdz'] = true,
['bej'] = true,
['bgn'] = true,
['bqi'] = true,
['brh'] = true,
['bsk'] = true,
['ckb'] = true,
['cld'] = true,
['deh'] = true,
['gay'] = true,
['gbz'] = true,
['glk'] = true,
['hac'] = true,
['haz'] = true,
['hbo'] = true,
['hnd'] = true,
['hno'] = true,
['jog'] = true,
['jrb'] = true,
['jye'] = true,
['khw'] = true,
['kls'] = true,
['kvx'] = true,
['lrc'] = true,
['lss'] = true,
['luz'] = true,
['mey'] = true,
['mid'] = true,
['mki'] = true,
['mnj'] = true,
['mwr'] = true,
['myz'] = true,
['mzb'] = true,
['mzn'] = true,
['nlm'] = true,
['nqo'] = true,
['oru'] = true,
['ota'] = true,
['otk'] = true,
['pal'] = true,
['pes'] = true,
['prs'] = true,
['prx'] = true,
['rif'] = true,
['rys'] = true,
['sbn'] = true,
['scl'] = true,
['sgh'] = true,
['siz'] = true,
['skr'] = true,
['sqo'] = true,
['sqr'] = true,
['srh'] = true,
['syc'] = true,
['syr'] = true,
['tru'] = true,
['ttt'] = true,
['wbl'] = true,
['wne'] = true,
['xaa'] = true,
['xdm'] = true,
['xhe'] = true,
['xqa'] = true,
['ydg'] = true,
}
--[[--------------------------< S C R I P T _ T >--------------------------------------------------------------
table of language tags that use script subtags
Data in this table scraped from {{lang-xx}} templates that set |script=<script tag>
keys (tags) in this table must be lowercase.
]]
local script_t = {
----------< I S O 6 3 9 - 1 >----------
['ce'] = 'Cyrl',
['ff'] = 'Latn',
['sh'] = 'Latn',
----------< I S O 6 3 9 - 2 , - 3 >----------
['bft'] = 'Aran',
['brx'] = 'Deva',
['bsk'] = 'Aran',
['chr'] = 'Cher',
['dgo'] = 'Deva',
['dng'] = 'Cyrl',
['dyu'] = 'Latn',
['ess'] = 'Latn',
['evn'] = 'Cyrl',
['sat'] = 'Olck',
['shn'] = 'Mymr',
}
--[[--------------------------< S I Z E _ T >------------------------------------------------------------------
table of language tags that use |size=
Data in this table scraped from {{lang-xx}} templates that set |size=<size>
keys (tags) in this table must be lowercase.
]]
local size_t = {
['bft'] = '125%',
}
--[[--------------------------< L I N K _ T >------------------------------------------------------------------
table of language tags that use |link=
Data in this table scraped from {{lang-xx}} templates that set |link=
keys (tags) in this table must be lowercase.
]]
local link_t = {
['en'] = 'no',
}
--[[--------------------------< U N S U P P O R T E D _ T >----------------------------------------------------
these are language tags from {{lang-??}} templates that should not be converted to {{langx}} during the transition
from {{lang-??}} to {{langx|??}}.
this table used to add a category when {{langx}} templates are encountered with these language tags.
contents of this table copied from Wikipedia:Templates_for_discussion/Log/2024_September_27/lang-%3F%3F_templates#excluded_templates
]]
local unsupported_t = {
['ast-leo'] = true,
['bcs-latn-cyrl'] = true,
['bcs'] = true,
['cnr-cyrl'] = true,
['cnr-cyrl-latn'] = true,
['cnr-latn'] = true,
['cnr-latn-cyrl'] = true,
['crh3'] = true,
['est-sea'] = true,
['fra-frc'] = true,
['grc-gre'] = true,
['hmd'] = true,
['ka'] = true,
['ku-arab'] = true,
['lmo-cr'] = true,
['lmo-it'] = true,
['mnc'] = true,
['my-mymr'] = true,
['my-name-mlcts'] = true,
['pun'] = true,
['rus'] = true,
['sa2'] = true,
['sh-cyrl-latn'] = true,
['sh-cyrl'] = true,
['sh-latn-cyrl'] = true,
['sh-latn'] = true,
['sq-definite'] = true,
['sr-cyrl-latn'] = true,
['sr-cyrl'] = true,
['sr-latn-cyrl'] = true,
['sr-latn'] = true,
['su-fonts'] = true,
['uniturk'] = true,
['uz-cyrl-latn'] = true,
['uz-latn-cyrl'] = true,
['uz-latn'] = true,
['vi-chunom'] = true,
['vi-hantu'] = true,
['zh'] = true,
['1ca'] = true,
-- Moldovan Cyrillic
}
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return {
inherit_t = inherit_t,
link_t = link_t,
rtl_t = rtl_t,
script_t = script_t,
size_t = size_t,
unsupported_t = unsupported_t,
}