From OpenStreetMap Wiki
Jump to: navigation, search
[Edit] [Octicons-sync.svgpurge] Template-info.svg Template documentation
Available languages — Relation/doc
Afrikaans Alemannisch aragonés asturianu azərbaycanca Bahasa Indonesia Bahasa Melayu Bân-lâm-gú Basa Jawa Baso Minangkabau bosanski brezhoneg català čeština dansk Deutsch eesti English español Esperanto estremeñu euskara français Frysk Gaeilge Gàidhlig galego Hausa hrvatski Igbo interlingua Interlingue isiXhosa isiZulu íslenska italiano Kiswahili Kreyòl ayisyen kréyòl gwadloupéyen kurdî latviešu Lëtzebuergesch lietuvių magyar Malagasy Malti Nederlands Nedersaksies norsk norsk nynorsk occitan Oromoo oʻzbekcha/ўзбекча Plattdüütsch polski português português do Brasil română shqip slovenčina slovenščina Soomaaliga suomi svenska Tiếng Việt Türkçe Vahcuengh vèneto Wolof Yorùbá Zazaki српски / srpski беларуская български қазақша македонски монгол русский тоҷикӣ українська Ελληνικά Հայերեն ქართული नेपाली मराठी हिन्दी অসমীয়া বাংলা ਪੰਜਾਬੀ ગુજરાતી ଓଡ଼ିଆ தமிழ் తెలుగు ಕನ್ನಡ മലയാളം සිංහල ไทย မြန်မာဘာသာ ລາວ ភាសាខ្មែរ ⵜⴰⵎⴰⵣⵉⵖⵜ አማርኛ 한국어 日本語 中文(简体)‎ 吴语 粵語 中文(繁體)‎ ייִדיש עברית اردو العربية پښتو سنڌي فارسی ދިވެހިބަސް
Dialog-warning-yellow.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]

This page documents the features of the templates {{Area}}, {{Node}}, {{Relation}}, and {{Way}}. These templates can be used for inserting links to either nodes, ways, or relations (area links to a closed way) as well as tool links. All templates share a common codebase. Therefore, they work almost identical ({{Area}} and {{Relation}} have each a minor difference to the rest).
It was rewritten in Fall 2018 using fewer options and Lua.


The usage is similar for all templates described here. You just have to adjust the name (e.g. {{Area|...}} instead of {{Node|...}}). Writing


results in

node 12345

Overview of all parameters:

Name/Number Possible values Description
1 Integer refers to an OSM ID, required parameter
2 String label for the main link, default: same as ID
tools all, josm, mini, no, or short tool links to be displayed, default: no(ne)
lang language code from Mediawiki's list or special code in this wiki used to assure the labelling of the links in a certain language (see section Translation below)

Comparison to the old version

Changes are marked with a yellow background, removals red, additions green.

Wiki code Template:Relation (old) current implementation
{{Relation|2345}} relation 2345 (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML) relation 2345
{{Relation|2345|Promenade}} relation Promenade (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML) relation Promenade
{{Relation|2345|Promenade|state= OK }} relation Promenade (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML)
{{Relation|2345|Promenade|state= complete }} relation Promenade (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML)
{{Relation|2345|Promenade|state= partial }} relation Promenade (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML)
{{Relation|2345|Promenade|state= FIXME }} relation Promenade (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML)
{{Relation|2345|Promenade|FIXME= 1 }} relation Promenade (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML)
{{Relation|2345|Promenade|FIXME= approximative borders }} relation Promenade (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML)
{{Relation|2345|tools= all }} - relation 2345 (iD JOSM Potlatch2 history analyse)
{{Relation|2345|tools= all |Promenade}} - relation Promenade (iD JOSM Potlatch2 history analyse)
{{Relation|2345|tools= all |lang= vi }} - relation 2345 (iD JOSM Potlatch2 lịch sử phân tích)
{{Relation|2345|Promenade|tools= all |lang= ar }} - relation Promenade (iD JOSM Potlatch2 التاريخ analyse) Help translate this to Arabic
{{Relation|2345|tools= josm }} relation 2345 (JOSM) relation 2345 (JOSM)
{{Relation|2345|tools= josm |Promenade}} relation Promenade (JOSM) relation Promenade (JOSM)
{{Relation|2345|tools= no }} relation 2345 relation 2345
{{Relation|2345|tools= no |Promenade}} relation Promenade relation Promenade
{{Relation|2345|tools= short }} relation Promenade 2345 (i J P2)
{{Relation|2345|tools= short |Promenade}} relation Promenade Promenade (i J P2)
{{Relation|2345|tools= mini }} 2345 2345
{{Relation|2345|tools= mini |Promenade}} Promenade Promenade
{{Relation|2345|tools= mini |Promenade|state= OK }} Promenade
{{Relation|2345|tools= mini |Promenade|state= complete }} Promenade
{{Relation|2345|tools= mini |Promenade|state= partial }} Promenade
{{Relation|2345|tools= mini |Promenade|state= FIXME }} Promenade
{{Relation|2345|tools= mini |Promenade|FIXME= 1 }} Promenade
{{Relation|2345|tools= mini |Promenade|FIXME= approximative borders }} Promenade
{{Relation||Promenade}} Relation not defined yet for Promenade
{{Relation||Promenade|tools= mini }} Relation not defined yet for Promenade
{{Relation|}} Relation not defined yet
{{Relation||tools= mini }} Relation not defined yet


If the parameter tools is set to all, the link labelled history will be shown. In case of {{Relation}} there is an additional link analyse. Their labels will align themselves to the page language. There is also a lang parameter for explicitly setting the language. Extracting the language of a page seems to be an expensive process (for the parser which takes longer to create the page). Unfortunately, this is also repeated for every occurrence of the template even on the same page. Therefore, translations are limited to a minimum (i.e. there is a translation with tools=all only).

lang parameter

The lang parameter is used to explicitly request a translated version of the template. It translates two English texts ("analyse" and "history"). These are used with the setting tools=all only. It also adds the prefix for the link to the article "relation" (below the icon) regardless of its existence. Whilst the language is automatically detected, the link will not change without request. This is due to the fact that the icon's wikicode is generated before the language version may be detected.

Languages for Translation

The module currently stores all translations in its code. Later, it would be reasonable to move this to a specialized "Language" module. There are the following priorities for examining the correct language:

  1. user input
  2. dedicated language namespace
  3. language title prefix
  4. 'en' as default

This means that there is no specified fallback language used apart from English.

Adding a Language

Please paste the following lines into the code of Module:Element/translation (the language codes are sorted alphabetically):

translateAnalyse = {
	... other language codes
	['code'] = "your translation",
translateHistory = {
	... other language codes
	['code'] = "your translation",

Missing language

If there is no complete translation, the page is also added to one of the subcategories of Category:Pages with missing translation. This is useful for finding missing translations in this wiki. The language name is inferred by the method mw.language.fetchLanguageName(pageLanguage, 'en') and some manual changes to it (different psuedo-namespace names in this wiki).

Design Decisions

This section aims to explain why this template works this way. It should be read before proposing any changes. There may be different opinions (see Discussion page), but this documentation only focuses on the current implementation.

Why are the tools not shown by default?
This is simply too "expensive" (see translation). This setting would result in many pages being displayed in maintenance categories like Category:Pages where template include size is exceeded. It would also assume that everyone using this template (think of a mapper fixing a wiki error without wiki background) wants to have all tools available.
Why are there so few tools only?
This is a general purpose template, if you need special links, you can add them directly to your page. Please remember that the parser is not able to cache this template, so if you link to five relations, it has to create 35 (= 5 * 7) links in the worst case (i.e. displaying all tools).
Why was the "undefined relation" option dropped?
Simply because it fails its purpose: This template is for linking to a relation, if there is no relation (yet) you can simply leave out this template (this is commonly done now anyway). This would be like a link to a web page with an "under construction" banner only. In addition, as it displayed text, it had to compute the page language and translate the text for every call. A functionality that can be archived at lower cost by inserting the text itself.
Why is there no "status"?
This parameter is not commonly used. Instead Template:State is used, which is more detailed (esp. for relations).
Why are shortened URLs used instead of the long forms?
There are pages that include this template over 1000 times. Replacing short URLs like osm.org with openstreetmap.org would increase the size of the expanded text by 11 characters. The change would scale up to 11,000 characters in such an article. There are also options which use multiple links.