Difference between revisions of "Template:GetLang"

From PC-BSD Wiki
Jump to: navigation, search
 
(21 intermediate revisions by one user not shown)
Line 1: Line 1:
<onlyinclude>{{#if: {{#titleparts: {{PAGENAME}}|1|3}}|{{#titleparts: {{PAGENAME}}|1|3}}|}}</onlyinclude><noinclude>
+
<onlyinclude>{{#switch: {{#titleparts: {{PAGENAME}}|1|3}} <!-- check for pagename/vers/xx -->
 +
|aa = aa
 +
|ab = ab
 +
|ace = ace
 +
|af = af
 +
|ak = ak
 +
|aln = aln
 +
|als = als
 +
|am = am
 +
|an = an
 +
|ang = ang
 +
|anp = anp
 +
|ar = ar
 +
|arc = arc
 +
|arn = arn
 +
|ary = ary
 +
|arz = arz
 +
|as = as
 +
|ast = ast
 +
|av = av
 +
|avk = avk
 +
|ay = ay
 +
|az = az
 +
|ba = ba
 +
|bar = bar
 +
|bat-smg = bat-smg
 +
|bcc = bcc
 +
|bcl = bcl
 +
|be = be
 +
|be-tarask = be-tarask
 +
|be-x-old = be-x-old
 +
|bg = bg
 +
|bh = bh
 +
|bho = bho
 +
|bi = bi
 +
|bjn = bjn
 +
|bm = bm
 +
|bn = bn
 +
|bo = bo
 +
|bpy = bpy
 +
|bqi = bqi
 +
|br = br
 +
|brh = brh
 +
|bs = bs
 +
|bug = bug
 +
|bxr = bxr
 +
|ca = ca
 +
|cbk-zam = cbk-zam
 +
|cdo = cdo
 +
|ce = ce
 +
|ceb = ceb
 +
|ch = ch
 +
|cho = cho
 +
|chr = chr
 +
|chy = chy
 +
|ckb = ckb
 +
|co = co
 +
|cps = cps
 +
|cr = cr
 +
|crh = crh
 +
|crh-cyrl = crh-cyrl
 +
|crh-latn = crh-latn
 +
|cs = cs
 +
|csb = csb
 +
|cu = cu
 +
|cv = cv
 +
|cy = cy
 +
|da = da
 +
|de = de
 +
|de-at = de-at
 +
|de-ch = de-ch
 +
|de-formal = de-formal
 +
|diq = diq
 +
|dsb = dsb
 +
|dtp = dtp
 +
|dv = dv
 +
|dz = dz
 +
|ee = ee
 +
|egl = egl
 +
|el = el
 +
|eml = eml
 +
|en = en
 +
|en-ca = en-ca
 +
|en-gb = en-gb
 +
|eo = eo
 +
|es = es
 +
|et = et
 +
|eu = eu
 +
|ext = ext
 +
|fa = fa
 +
|ff = ff
 +
|fi = fi
 +
|fit = fit
 +
|fiu-vro = fiu-vro
 +
|fj = fj
 +
|fo = fo
 +
|fr = fr
 +
|frc = frc
 +
|frp = frp
 +
|frr = frr
 +
|fur = fur
 +
|fy = fy
 +
|ga = ga
 +
|gag = gag
 +
|gan = gan
 +
|gan-hans = gan-hans
 +
|gan-hant = gan-hant
 +
|gd = gd
 +
|gl = gl
 +
|glk = glk
 +
|gn = gn
 +
|got = got
 +
|grc = grc
 +
|gsw = gsw
 +
|gu = gu
 +
|gv = gv
 +
|ha = ha
 +
|hak = hak
 +
|haw = haw
 +
|he = he
 +
|hi = hi
 +
|hif = hif
 +
|hif-latn = hif-latn
 +
|hil = hil
 +
|ho = ho
 +
|hr = hr
 +
|hsb = hsb
 +
|ht = ht
 +
|hu = hu
 +
|hy = hy
 +
|hz = hz
 +
|ia = ia
 +
|id = id
 +
|ie = ie
 +
|ig = ig
 +
|ii = ii
 +
|ik = ik
 +
|ike-cans = ike-cans
 +
|ike-latn = ike-latn
 +
|ilo = ilo
 +
|inh = inh
 +
|io = io
 +
|is = is
 +
|it = it
 +
|iu = iu
 +
|ja = ja
 +
|jam = jam
 +
|jbo = jbo
 +
|jut = jut
 +
|jv = jv
 +
|ka = ka
 +
|kaa = kaa
 +
|kab = kab
 +
|kbd = kbd
 +
|kbd-cyrl = kbd-cyrl
 +
|kg = kg
 +
|khw = khw
 +
|ki = ki
 +
|kiu = kiu
 +
|kj = kj
 +
|kk = kk
 +
|kk-arab = kk-arab
 +
|kk-cn = kk-cn
 +
|kk-cyrl = kk-cyrl
 +
|kk-kz = kk-kz
 +
|kk-latn = kk-latn
 +
|kk-tr = kk-tr
 +
|kl = kl
 +
|km = km
 +
|kn = kn
 +
|ko = ko
 +
|ko-kp = ko-kp
 +
|koi = koi
 +
|kr = kr
 +
|krc = krc
 +
|kri = kri
 +
|krj = krj
 +
|ks = ks
 +
|ks-arab = ks-arab
 +
|ks-deva = ks-deva
 +
|ksh = ksh
 +
|ku = ku
 +
|ku-arab = ku-arab
 +
|ku-latn = ku-latn
 +
|kv = kv
 +
|kw = kw
 +
|ky = ky
 +
|la = la
 +
|lad = lad
 +
|lb = lb
 +
|lbe = lbe
 +
|lez = lez
 +
|lfn = lfn
 +
|lg = lg
 +
|li = li
 +
|lij = lij
 +
|liv = liv
 +
|lmo = lmo
 +
|ln = ln
 +
|lo = lo
 +
|loz = loz
 +
|lt = lt
 +
|ltg = ltg
 +
|lus = lus
 +
|lv = lv
 +
|lzh = lzh
 +
|lzz = lzz
 +
|mai = mai
 +
|map-bms = map-bms
 +
|mdf = mdf
 +
|mg = mg
 +
|mh = mh
 +
|mhr = mhr
 +
|mi = mi
 +
|min = min
 +
|mk = mk
 +
|ml = ml
 +
|mn = mn
 +
|mo = mo
 +
|mr = mr
 +
|mrj = mrj
 +
|ms = ms
 +
|mt = mt
 +
|mus = mus
 +
|mwl = mwl
 +
|my = my
 +
|myv = myv
 +
|mzn = mzn
 +
|na = na
 +
|nah = nah
 +
|nan = nan
 +
|nap = nap
 +
|nb = nb
 +
|nds = nds
 +
|nds-nl = nds-nl
 +
|ne = ne
 +
|new = new
 +
|ng = ng
 +
|niu = niu
 +
|nl = nl
 +
|nl-informal = nl-informal
 +
|nn = nn
 +
|no = no
 +
|nov = nov
 +
|nrm = nrm
 +
|nso = nso
 +
|nv = nv
 +
|ny = ny
 +
|oc = oc
 +
|om = om
 +
|or = or
 +
|os = os
 +
|pa = pa
 +
|pag = pag
 +
|pam = pam
 +
|pap = pap
 +
|pcd = pcd
 +
|pdc = pdc
 +
|pdt = pdt
 +
|pfl = pfl
 +
|pi = pi
 +
|pih = pih
 +
|pl = pl
 +
|pms = pms
 +
|pnb = pnb
 +
|pnt = pnt
 +
|prg = prg
 +
|ps = ps
 +
|pt = pt
 +
|pt-br = pt-br
 +
|qu = qu
 +
|qug = qug
 +
|rgn = rgn
 +
|rif = rif
 +
|rm = rm
 +
|rmy = rmy
 +
|rn = rn
 +
|ro = ro
 +
|roa-rup = roa-rup
 +
|roa-tara = roa-tara
 +
|ru = ru
 +
|rue = rue
 +
|rup = rup
 +
|ruq = ruq
 +
|ruq-cyrl = ruq-cyrl
 +
|ruq-latn = ruq-latn
 +
|rw = rw
 +
|sa = sa
 +
|sah = sah
 +
|sat = sat
 +
|sc = sc
 +
|scn = scn
 +
|sco = sco
 +
|sd = sd
 +
|sdc = sdc
 +
|se = se
 +
|sei = sei
 +
|sg = sg
 +
|sgs = sgs
 +
|sh = sh
 +
|shi = shi
 +
|shi-latn = shi-latn
 +
|shi-tfng = shi-tfng
 +
|si = si
 +
|simple = simple
 +
|sk = sk
 +
|sl = sl
 +
|sli = sli
 +
|sm = sm
 +
|sma = sma
 +
|sn = sn
 +
|so = so
 +
|sq = sq
 +
|sr = sr
 +
|sr-ec = sr-ec
 +
|sr-el = sr-el
 +
|srn = srn
 +
|ss = ss
 +
|st = st
 +
|stq = stq
 +
|su = su
 +
|sv = sv
 +
|sw = sw
 +
|szl = szl
 +
|ta = ta
 +
|tcy = tcy
 +
|te = te
 +
|tet = tet
 +
|tg = tg
 +
|tg-cyrl = tg-cyrl
 +
|tg-latn = tg-latn
 +
|th = th
 +
|ti = ti
 +
|tk = tk
 +
|tl = tl
 +
|tly = tly
 +
|tn = tn
 +
|to = to
 +
|tokipona = tokipona
 +
|tpi = tpi
 +
|tr = tr
 +
|tru = tru
 +
|ts = ts
 +
|tt = tt
 +
|tt-cyrl = tt-cyrl
 +
|tt-latn = tt-latn
 +
|tum = tum
 +
|tw = tw
 +
|ty = ty
 +
|tyv = tyv
 +
|udm = udm
 +
|ug = ug
 +
|ug-arab = ug-arab
 +
|ug-latn = ug-latn
 +
|uk = uk
 +
|ur = ur
 +
|uz = uz
 +
|ve = ve
 +
|vec = vec
 +
|vep = vep
 +
|vi = vi
 +
|vls = vls
 +
|vmf = vmf
 +
|vo = vo
 +
|vot = vot
 +
|vro = vro
 +
|wa = wa
 +
|war = war
 +
|wo = wo
 +
|wuu = wuu
 +
|xal = xal
 +
|xh = xh
 +
|xmf = xmf
 +
|yi = yi
 +
|yo = yo
 +
|yue = yue
 +
|za = za
 +
|zea = zea
 +
|zh = zh
 +
|zh-classical = zh-classical
 +
|zh-cn = zh-cn
 +
|zh-hans = zh-hans
 +
|zh-hant = zh-hant
 +
|zh-hk = zh-hk
 +
|zh-min-nan = zh-min-nan
 +
|zh-mo = zh-mo
 +
|zh-my = zh-my
 +
|zh-sg = zh-sg
 +
|zh-tw = zh-tw
 +
|zh-yue = zh-yue
 +
|zu = zu
 +
|
 +
{{#switch: {{#titleparts: {{PAGENAME}}|1|2}} <!-- now check for pagename/xx -->
 +
|aa = aa
 +
|ab = ab
 +
|ace = ace
 +
|af = af
 +
|ak = ak
 +
|aln = aln
 +
|als = als
 +
|am = am
 +
|an = an
 +
|ang = ang
 +
|anp = anp
 +
|ar = ar
 +
|arc = arc
 +
|arn = arn
 +
|ary = ary
 +
|arz = arz
 +
|as = as
 +
|ast = ast
 +
|av = av
 +
|avk = avk
 +
|ay = ay
 +
|az = az
 +
|ba = ba
 +
|bar = bar
 +
|bat-smg = bat-smg
 +
|bcc = bcc
 +
|bcl = bcl
 +
|be = be
 +
|be-tarask = be-tarask
 +
|be-x-old = be-x-old
 +
|bg = bg
 +
|bh = bh
 +
|bho = bho
 +
|bi = bi
 +
|bjn = bjn
 +
|bm = bm
 +
|bn = bn
 +
|bo = bo
 +
|bpy = bpy
 +
|bqi = bqi
 +
|br = br
 +
|brh = brh
 +
|bs = bs
 +
|bug = bug
 +
|bxr = bxr
 +
|ca = ca
 +
|cbk-zam = cbk-zam
 +
|cdo = cdo
 +
|ce = ce
 +
|ceb = ceb
 +
|ch = ch
 +
|cho = cho
 +
|chr = chr
 +
|chy = chy
 +
|ckb = ckb
 +
|co = co
 +
|cps = cps
 +
|cr = cr
 +
|crh = crh
 +
|crh-cyrl = crh-cyrl
 +
|crh-latn = crh-latn
 +
|cs = cs
 +
|csb = csb
 +
|cu = cu
 +
|cv = cv
 +
|cy = cy
 +
|da = da
 +
|de = de
 +
|de-at = de-at
 +
|de-ch = de-ch
 +
|de-formal = de-formal
 +
|diq = diq
 +
|dsb = dsb
 +
|dtp = dtp
 +
|dv = dv
 +
|dz = dz
 +
|ee = ee
 +
|egl = egl
 +
|el = el
 +
|eml = eml
 +
|en = en
 +
|en-ca = en-ca
 +
|en-gb = en-gb
 +
|eo = eo
 +
|es = es
 +
|et = et
 +
|eu = eu
 +
|ext = ext
 +
|fa = fa
 +
|ff = ff
 +
|fi = fi
 +
|fit = fit
 +
|fiu-vro = fiu-vro
 +
|fj = fj
 +
|fo = fo
 +
|fr = fr
 +
|frc = frc
 +
|frp = frp
 +
|frr = frr
 +
|fur = fur
 +
|fy = fy
 +
|ga = ga
 +
|gag = gag
 +
|gan = gan
 +
|gan-hans = gan-hans
 +
|gan-hant = gan-hant
 +
|gd = gd
 +
|gl = gl
 +
|glk = glk
 +
|gn = gn
 +
|got = got
 +
|grc = grc
 +
|gsw = gsw
 +
|gu = gu
 +
|gv = gv
 +
|ha = ha
 +
|hak = hak
 +
|haw = haw
 +
|he = he
 +
|hi = hi
 +
|hif = hif
 +
|hif-latn = hif-latn
 +
|hil = hil
 +
|ho = ho
 +
|hr = hr
 +
|hsb = hsb
 +
|ht = ht
 +
|hu = hu
 +
|hy = hy
 +
|hz = hz
 +
|ia = ia
 +
|id = id
 +
|ie = ie
 +
|ig = ig
 +
|ii = ii
 +
|ik = ik
 +
|ike-cans = ike-cans
 +
|ike-latn = ike-latn
 +
|ilo = ilo
 +
|inh = inh
 +
|io = io
 +
|is = is
 +
|it = it
 +
|iu = iu
 +
|ja = ja
 +
|jam = jam
 +
|jbo = jbo
 +
|jut = jut
 +
|jv = jv
 +
|ka = ka
 +
|kaa = kaa
 +
|kab = kab
 +
|kbd = kbd
 +
|kbd-cyrl = kbd-cyrl
 +
|kg = kg
 +
|khw = khw
 +
|ki = ki
 +
|kiu = kiu
 +
|kj = kj
 +
|kk = kk
 +
|kk-arab = kk-arab
 +
|kk-cn = kk-cn
 +
|kk-cyrl = kk-cyrl
 +
|kk-kz = kk-kz
 +
|kk-latn = kk-latn
 +
|kk-tr = kk-tr
 +
|kl = kl
 +
|km = km
 +
|kn = kn
 +
|ko = ko
 +
|ko-kp = ko-kp
 +
|koi = koi
 +
|kr = kr
 +
|krc = krc
 +
|kri = kri
 +
|krj = krj
 +
|ks = ks
 +
|ks-arab = ks-arab
 +
|ks-deva = ks-deva
 +
|ksh = ksh
 +
|ku = ku
 +
|ku-arab = ku-arab
 +
|ku-latn = ku-latn
 +
|kv = kv
 +
|kw = kw
 +
|ky = ky
 +
|la = la
 +
|lad = lad
 +
|lb = lb
 +
|lbe = lbe
 +
|lez = lez
 +
|lfn = lfn
 +
|lg = lg
 +
|li = li
 +
|lij = lij
 +
|liv = liv
 +
|lmo = lmo
 +
|ln = ln
 +
|lo = lo
 +
|loz = loz
 +
|lt = lt
 +
|ltg = ltg
 +
|lus = lus
 +
|lv = lv
 +
|lzh = lzh
 +
|lzz = lzz
 +
|mai = mai
 +
|map-bms = map-bms
 +
|mdf = mdf
 +
|mg = mg
 +
|mh = mh
 +
|mhr = mhr
 +
|mi = mi
 +
|min = min
 +
|mk = mk
 +
|ml = ml
 +
|mn = mn
 +
|mo = mo
 +
|mr = mr
 +
|mrj = mrj
 +
|ms = ms
 +
|mt = mt
 +
|mus = mus
 +
|mwl = mwl
 +
|my = my
 +
|myv = myv
 +
|mzn = mzn
 +
|na = na
 +
|nah = nah
 +
|nan = nan
 +
|nap = nap
 +
|nb = nb
 +
|nds = nds
 +
|nds-nl = nds-nl
 +
|ne = ne
 +
|new = new
 +
|ng = ng
 +
|niu = niu
 +
|nl = nl
 +
|nl-informal = nl-informal
 +
|nn = nn
 +
|no = no
 +
|nov = nov
 +
|nrm = nrm
 +
|nso = nso
 +
|nv = nv
 +
|ny = ny
 +
|oc = oc
 +
|om = om
 +
|or = or
 +
|os = os
 +
|pa = pa
 +
|pag = pag
 +
|pam = pam
 +
|pap = pap
 +
|pcd = pcd
 +
|pdc = pdc
 +
|pdt = pdt
 +
|pfl = pfl
 +
|pi = pi
 +
|pih = pih
 +
|pl = pl
 +
|pms = pms
 +
|pnb = pnb
 +
|pnt = pnt
 +
|prg = prg
 +
|ps = ps
 +
|pt = pt
 +
|pt-br = pt-br
 +
|qu = qu
 +
|qug = qug
 +
|rgn = rgn
 +
|rif = rif
 +
|rm = rm
 +
|rmy = rmy
 +
|rn = rn
 +
|ro = ro
 +
|roa-rup = roa-rup
 +
|roa-tara = roa-tara
 +
|ru = ru
 +
|rue = rue
 +
|rup = rup
 +
|ruq = ruq
 +
|ruq-cyrl = ruq-cyrl
 +
|ruq-latn = ruq-latn
 +
|rw = rw
 +
|sa = sa
 +
|sah = sah
 +
|sat = sat
 +
|sc = sc
 +
|scn = scn
 +
|sco = sco
 +
|sd = sd
 +
|sdc = sdc
 +
|se = se
 +
|sei = sei
 +
|sg = sg
 +
|sgs = sgs
 +
|sh = sh
 +
|shi = shi
 +
|shi-latn = shi-latn
 +
|shi-tfng = shi-tfng
 +
|si = si
 +
|simple = simple
 +
|sk = sk
 +
|sl = sl
 +
|sli = sli
 +
|sm = sm
 +
|sma = sma
 +
|sn = sn
 +
|so = so
 +
|sq = sq
 +
|sr = sr
 +
|sr-ec = sr-ec
 +
|sr-el = sr-el
 +
|srn = srn
 +
|ss = ss
 +
|st = st
 +
|stq = stq
 +
|su = su
 +
|sv = sv
 +
|sw = sw
 +
|szl = szl
 +
|ta = ta
 +
|tcy = tcy
 +
|te = te
 +
|tet = tet
 +
|tg = tg
 +
|tg-cyrl = tg-cyrl
 +
|tg-latn = tg-latn
 +
|th = th
 +
|ti = ti
 +
|tk = tk
 +
|tl = tl
 +
|tly = tly
 +
|tn = tn
 +
|to = to
 +
|tokipona = tokipona
 +
|tpi = tpi
 +
|tr = tr
 +
|tru = tru
 +
|ts = ts
 +
|tt = tt
 +
|tt-cyrl = tt-cyrl
 +
|tt-latn = tt-latn
 +
|tum = tum
 +
|tw = tw
 +
|ty = ty
 +
|tyv = tyv
 +
|udm = udm
 +
|ug = ug
 +
|ug-arab = ug-arab
 +
|ug-latn = ug-latn
 +
|uk = uk
 +
|ur = ur
 +
|uz = uz
 +
|ve = ve
 +
|vec = vec
 +
|vep = vep
 +
|vi = vi
 +
|vls = vls
 +
|vmf = vmf
 +
|vo = vo
 +
|vot = vot
 +
|vro = vro
 +
|wa = wa
 +
|war = war
 +
|wo = wo
 +
|wuu = wuu
 +
|xal = xal
 +
|xh = xh
 +
|xmf = xmf
 +
|yi = yi
 +
|yo = yo
 +
|yue = yue
 +
|za = za
 +
|zea = zea
 +
|zh = zh
 +
|zh-classical = zh-classical
 +
|zh-cn = zh-cn
 +
|zh-hans = zh-hans
 +
|zh-hant = zh-hant
 +
|zh-hk = zh-hk
 +
|zh-min-nan = zh-min-nan
 +
|zh-mo = zh-mo
 +
|zh-my = zh-my
 +
|zh-sg = zh-sg
 +
|zh-tw = zh-tw
 +
|zh-yue = zh-yue
 +
|zu = zu
 +
|
 +
}}
 +
}}</onlyinclude><noinclude>
  
The idea is to obtain the language of the current page.
+
The idea is to obtain the language of the current page, verify it against those known codes, and default to ''nothing'' if none are provided/match. The trouble was, that some pages are "versioned" and some are not, while both versioned and non-versioned pages may have a translation. The verification against known codes improves upon the position check for the language code which might be second such as colophon/en, or third, such as handbook/10.1/en.
 
[[category:templates]]
 
[[category:templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 19:39, 30 January 2015


The idea is to obtain the language of the current page, verify it against those known codes, and default to nothing if none are provided/match. The trouble was, that some pages are "versioned" and some are not, while both versioned and non-versioned pages may have a translation. The verification against known codes improves upon the position check for the language code which might be second such as colophon/en, or third, such as handbook/10.1/en.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox