Misplaced Pages

Template:ISO 639 name: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 19:23, 26 April 2009 view sourceMSGJ (talk | contribs)Autopatrolled, Administrators130,796 edits add ab← Previous edit Revision as of 19:25, 26 April 2009 view source MSGJ (talk | contribs)Autopatrolled, Administrators130,796 edits unnamed parametersNext edit →
Line 1: Line 1:
{{#switch:{{{code|}}} {{#switch:{{{1|}}}
|aa=Afar |aa=Afar
|ab=Abkhaz |ab=Abkhaz

Revision as of 19:25, 26 April 2009

Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 8,900 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
This template uses Lua:
Language templates
Language names (ISO 639)
Interwiki links
Foreign-language text
Other

Usage

The {{ISO 639 name}} template is used to resolve ISO 639-1, ISO 639-2, ISO 639-3 and ISO 639-5 codes to language names. It will trim extraneous IETF language tags to just the ISO 639 code. E.g.: Sanskrit in Latin script, which IETF language tag is sa-Latn, renders as:

  • {{ISO 639 name|sa-Latn}}

The error message can be suppressed with |hide-err=yes:

  • {{ISO 639 name|sa-Latn|hide-err=yes}}

The rendered language name can be linked to the appropriate language article with |link=yes:

  • {{ISO 639 name|sa-Latn|hide-err=yes|link=yes}}

When linking, an alternate link label can be provided with |label=<label text>:

  • {{ISO 639 name|sa-Latn|hide-err=yes|link=yes|label=sa-Latn}}

The {{ISO 639 name link}} template is the same as {{ISO 639 name}} except that it presets |link=yes.

Both of these templates can be safely substituted.

Other functions

This template can be used to execute any of the functions exported by Module:ISO 639 name. These function are:

  • iso_639_code_exists – returns true if <code> is found in any of the ISO 639 data tables
  • iso_639_code_to_name – (default) as described above
  • iso_639_code_1_to_name – same as iso_639_code_to_name except constrained to the ISO 639-1 data table
  • iso_639_code_2_to_name – same as iso_639_code_to_name except constrained to the ISO 639-2 data table
  • iso_639_code_2B_to_name – same as iso_639_code_to_name except constrained to the ISO 639-2B data table
  • iso_639_code_3_to_name – same as iso_639_code_to_name except constrained to the ISO 639-3 data table
  • iso_639_code_5_to_name – same as iso_639_code_to_name except constrained to the ISO 639-5 data table
  • iso_639_name_exists – returns true if <name> is found in any of the ISO 639 data tables
  • iso_639_name_to_code – returns language code associated with <name>; may be constrained to a particular ISO 639 data table
  • iso_639 – returns language name when given a valid language code; returns a language code when given a valid language name; may be constrained to a particular ISO 639 data table

To use these functions set |fn= to the appropriate function name.

Language codes

ISO 639-1 codes and matching codes from ISO 639-2, -2B, and -3
ISO 639-1 ISO 639-2 ISO 639-2B ISO 639-3 Name Article
aa Afar Afar
ab Abkhaz Abkhaz
ae
af
ak
am
an
ar
as
av
ay
az
ba
be
bg
bh bih
bi
bm
bn
bo
br
bs
ca
ce
ch
co
cr
cs
cu
cv
cy
da
de
dv
dz
ee
el ell gre
en
eo
es
et
eu
fa
ff
fi
fj
fo
fr
fy
ga
gd
gl
gn
gu
gv
ha
he
hi
ho
hr
ht
hu
hy
hz
ia
id
ie
ig
ii
ik
io
is
it
iu
ja
jv
ka
kg
ki
kj
kk
kl
km khm
kn
ko
kr
ks
ku
kv
kw
ky
la
lb
lg
li
ln
lo
lt
lu
lv
mg
mh
mi
mk
ml
mn
mr
ms msa may
mt
my
na
nb
nd
ne nep
ng
nl
nn
no
nr
nv
ny
oc
oj
om
or ori
os
pa
pi
pl
ps
pt
qu
rm
rn
ro
ru
rw
sa
sc
sd
se
sg
sh
si
sk
sl
sm
sn
so
sq
sr
ss
st sot
su
sv
sw swa
ta
te
tg
th
ti
tk
tl
tn
to
tr
ts
tt
tw
ty
ug
uk
ur
uz
ve
vi
vo
wa
wo
xh
yi
yo
za
zh
zu

Notes

  1. There are only 20 ISO 639-2B codes.
  2. ^ Code not assigned.

Examples

  • {{ISO 639 name|en}} gives
  • {{ISO 639 name|fr}} gives

Error messages

This template produces error messages. These messages are:

  • <code> is an IETF tag – IETF language tags are not ISO 639 language codes. When these tags are encountered, the template attempts to render the correct language and also emits this error message
  • ISO 639-<part> code is required – where <part> is 1, 2, 3, 5; template was called without the required language code
  • <code> is not an ISO 639-<part> code – <code> fails simple length validation; 639 part 1, language codes are two characters, for 639 parts 2, 3, and 5, language codes are three characters
  • <code> not found in ISO 639-<part> list – <code> not found after searching ISO 639-<part> data

The module that does the work for this template has other functionality not supported by this template. See Module:ISO 639 name. Error messages related to that other functionality are:

  • language name required – module function iso_639_name_to_code() only – this message emitted when a language name is not provided in the {{#invoke:}}
  • <part> not an ISO 639 part – module functions iso_639_name_to_code() and iso_639() only – this message emitted when <part> is not one of 1, 2, 3, or 5
  • language code or name required – module function iso_639() only – this message emitted when a language name or a language code is not provided in the {{#invoke:}}

Tracking categories

See also

The above documentation is transcluded from Template:ISO 639 name/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template. Category: