From OpenStreetMap Wiki
Jump to: navigation, search
Dialog-warning-orange.svg Note: This Template is used on a lot of pages. In order not to put too much load on the servers, edits should be kept to a bare minimum. Please discuss proposed changes on the talk page first.
  • Editing a Template causes all pages that use the Template to be re-rendered. If the Template is used often, this can put a lot of load on the servers since it fills up the job queue (statistics).


See Wikipedia:Meta:Template:LangSwitch for documentation.

The parameter |en= is mandatory for defining a default message in English (this message may be empty but the parameter must be present). If it is missing, the page will be listed in Category:Pages with missing en parameter in LangSwitch.

Supported language fallback chains

This template currently supports up to two fallbacks per language to look for, before using the "default" fallback (if it's specified, or "en" otherwise because the default language of this wiki for untranslated contents).

When a translated resource is missing in the supplied parameters, other languages will be looked for, in the following order, from right to left. In this diagram, the initial language code to look for is not betwen parentheses "()" which are used to indicate one of the supplied fallbacks. When multiple languages have the same fallbacks, they are listed separated by commas "," but there's no fallback between each other. The effective fallbacks are indicated by arrows indicating the order of search:

(en) ← default ←  en  ←  en-au, en-ca, en-gb, en-nz
             ↑↖←  ar  ←  arz
             ↑      ↑↖←  fa         ←  bal, ps, prs
             ↑       ↖← (fr)        ←  tzm, zgh
             ↑↖←  bg  ←  mk
             ↑↖← (bn) ←  as         ←  bn
             ↑↖← (cs) ←  sk         ←  cs
             ↑↖←  de  ←  bar, de-ch, de-at, dsb, frr, hsb, nds, stq
             ↑       ↖← (gsw-fr)    ←  gsw
             ↑↖←  es  ←  an, ast, ca, eu, ext, gl, qu
             ↑↖←  fr  ←  br, co, fr-ca, frp, gcf, ht, lb, mg, nrf, oc, ty, wa
             ↑       ↖← (gsw)       ←  gsw-fr
             ↑↖←  he  ←  yi
             ↑↖←  hi  ←  sa
             ↑↖←  hr  ←  bs, hbs
             ↑      ↑↖←  sr         ←  sr-latn
             ↑       ↖← (sr)        ←  sr-cyrl
             ↑↖← (id) ←  ms         ←  id      ←  jv, min, su
             ↑↖←  it  ←  egl, eml, lij, nap, pms, rgn, sc, scn, sdc, vec
             ↑↖←  ja  ←  ain
             ↑↖←  nl  ←  fy, li, nds-nl, vls, zea
             ↑↖← (nb) ← (no)        ←  nn
             ↑↖← (nn) ← (no)        ←  nb
             ↑       ↖← (nb)        ←  no
             ↑↖←  pl  ←  csb, szl, wym
             ↑↖← (pt) ←  pt-br      ←  pt, mwl
             ↑↖←  ro  ←  aln, rup, ruq
             ↑↖←  ru  ←  av, crh, kbd, kk, mn, rue, tg, tk, tt, uk, uz
             ↑      ↑↖← (be)        ←  be-tarask
             ↑      ↑↖← (be-tarask) ←  be
             ↑       ↖←  ka         ←  ab
             ↑←   th  ←  tts, nod, sou
             ↑↖←  tr  ←  diq, kiu, zza
             ↑↖← (ur) ←  sd         ←  ur
              ↖← (zh) ← (zh-hans)   ←  zh, zh-cn, zh-sg, zh-hant
                     ↖← (zh-hant)   ←  lzh, nan, wuu, yii, yue, za, zh-hans, zh-hk, zh-mo, zh-tw

The fallbacks may be a bit different or more complete on Wikimedia sites, which have integrated support for Lua modules, allowing them to retrieve the language fallbacks used in Mediawiki itself. But the OSM wiki still has no support for Lua, so this is list is still completely implemented instead by this template using basic MediaWiki syntax for template transclusion.


This template still does not work as bast as intended if it could use {{Int:Lang}}, but which requires resources in "Mediawiki:Lang/*" loaded by the wiki administrator for all supported localisations of the MediaWiki software.

For example Mediawiki:Lang should contain en (the default language code of this wiki), and its subpages Mediawiki:Lang/en, Mediawiki:Lang/fr, etc. should contain en, fr, and so on for all supported language codes). In more recent versions, the special parser function int:Lang is treated internally by MediaWiki and no longer require preloading "Mediawiki:Lang/*" resources.

For this reason this template does not display the user's preferred language, but will display the message defined only by the language determined from the current page (by {{Langcode}}, using its namespace or a language code prefix in its title); when this language cannot be determined, it will return the default (English) message defined by the mandatory en parameter.

See also