Template:Hu:Relation/doc

From OpenStreetMap Wiki
Jump to: navigation, search
Más nyelveken — Relation
· Afrikaans · Alemannisch · aragonés · asturianu · Aymar aru · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · bamanankan · Bân-lâm-gú · Basa Jawa · Basa Sunda · Baso Minangkabau · bosanski · brezhoneg · català · čeština · corsu · 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î · Latina · latviešu · Lëtzebuergesch · lietuvių · Limburgs · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tagalog · Tiếng Việt · Türkçe · Türkmençe · Vahcuengh · vèneto · walon · Wolof · Yorùbá · Zazaki · isiZulu · српски / srpski · авар · Аҧсшәа · башҡортса · беларуская · български · қазақша · Кыргызча · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · भोजपुरी · मराठी · संस्कृतम् · हिन्दी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · བོད་ཡིག · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 中文(繁體)‎ · 吴语 · 粵語 · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް
Dialog-warning-yellow.svg Note:Segíts lefordítani magyar nyelvre! 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.Segíts lefordítani magyar nyelvre!
Please discuss proposed changes on the talk page first.Segíts lefordítani magyar nyelvre!
Editing a template causes all pages that use the template to be re-rendered.Segíts lefordítani magyar nyelvre! If the Template is used often, this can put a lot of load on the servers since it fills up the job queue.Segíts lefordítani magyar nyelvre! [statisticsSegíts lefordítani magyar nyelvre!]

Ez a sablon kapcsolatokra való wikis hivatkozások készítésénél alkalmazható. It was recently rewritten using fewer options and Lua.

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 történet elemez)
{{Relation|2345|tools= all |Promenade}} - relation Promenade (iD JOSM Potlatch2 történet elemez)
{{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

Translation

If the parameter tools is set to all, the links history and analyse will be shown. As in the old template, their labels will change to the page language. There is also a lang parameter for explicitly setting the language. As far as I understand, extracting the language is an expensive process (for the parser which takes longer to create the 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 (the language codes are sorted alphabetically):

elseif language == '...' then
	translation["analyse"] = ...
	translation["history"] = ...
	translation[1] = true -- only if you provide both translations, otherwise leave this line out

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

Why are the tools not shown by default?
This is simply to "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.
Why is there no "status"?
This parameter is not commonly used. Instead Template:State is used, which is more detailed (esp. for relations).

See also