Template:Hu:Relation/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

exclamation mark

Megjegyzés: Ezt a sablont sok lapon használjuk. A szerverek túlterhelésének elkerülése érdekében a szerkesztések számát lehetőleg minimalizálni kell.
A javasolt változtatásokat kérlek előbb beszéld meg vitalapon.
Egy sablon szerkesztése után az összes, őt tartalmazó lapot újra kell számítani. Ha a sablon sok helyen van használatban, ez nagy terhelést ró a szerverekre, mert megtölti a feladatsort. [statisztikák]

broom

Help (89606) - The Noun Project.svg

Ez a lap dokumentálja az {{Area}}, {{Node}}, {{Relation}}, és {{Way}} sablonok működését. Ezek a sablonok használhatóak pontokra, vonalakra és kapcsolatokra (zárt vonalra hivatkozó terület) hivatkozó linkek beillesztésére valamint eszköz linkekre. Az összes sablon közös kódbázison osztozik. Ennek következtében a működésük majdnem mindenben megegyezik (az {{Area}} és {{Relation}} kicsit eltér a többitől).
A sablon 2018 őszén újra lett írva kevesebb opcióval, Luában.

Használat

Az összes itt említett sablon használata hasonló, csak a nevét kell átírnod (pl. {{Node|...}} helyett {{Area|...}}). Az alábbi kód

{{node|12345}}

ezt eredményezi

node 12345

Az összes paraméter áttekintése

Név/Sorszám Lehetséges értékek Leírás
1 Szám egy OSM ID-re hivatkozik, kötelező paraméter
2 Szöveg a link felirata, alapértelmezett: megegyezik az ID-vel
tools all, josm, mini, no, or short megjelenítendő eszköz linkek alapértelmezett: no
lang egy MediaWiki nyelvkód vagy ezen wiki egy speciális kódja biztosítja a linkek megfelelő nyelvű feliratozását (lásd Fordítás fejezet alább)

Képesség lista

Wikikód Eredmény Megjegyzés
{{Relation|2345}} relation 2345 The icon links to the wiki article about relations.
{{Relation|2345|Promenade}} relation Promenade
{{Relation|2345|tools= all }} relation 2345 (iD JOSM history analyse)
{{Relation|2345|tools= all |Promenade}} relation Promenade (iD JOSM history analyse)
{{Relation|2345|tools= all |lang= vi }} relation 2345 (iD JOSM lịch sử phân tích) translation to Vietnamese
{{Relation|2345|Promenade|tools= all |lang= ar }} relation Promenade (iD JOSM التاريخ analyse) Help translate this to Arabic translation falls back to English as Arabic translation is incomplete.
{{Way|12346|tools= all |lang= ar }} way 12346 (iD JOSM التاريخ) links displayed depending on the element
{{Relation|2345|tools= josm }} relation 2345 (JOSM)
{{Relation|2345|tools= josm |Promenade}} relation Promenade (JOSM)
{{Relation|2345|tools= mini }} 2345
{{Relation|2345|tools= mini |Promenade}} Promenade
{{Relation|2345|tools= no }} relation 2345
{{Relation|2345|tools= no |Promenade}} relation Promenade
{{Relation|2345|tools= short }} 2345 (i J)
{{Relation|2345|tools= short |Promenade}} Promenade (i J)
{{Relation||Promenade}} Lua error in Module:Element at line 60: Given relation id parameter is not a number. Does not work, ID required.

Fordítás

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).

A lang paraméter

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.

Nyelvek fordításhoz

The module stores all translations in Module:Element/translation. There are the following priorities for examining the correct language:

  1. user input in lang parameter
  2. dedicated language namespace (DE, ES, FR, IT, JA, NL, RU)
  3. language title prefix (all other prefixes)
  4. English as default

This means that there is no specified fallback language used apart from English.
The templates {{Hu:Relation}}, {{Pl:Relation}} and {{Pt:Relation}} are versions of this template which fall back to Hungarian, Polish and Portuguese if no user input is provided.

Egy nyelv hozzáadása

Please paste the following lines into the code of Module:Element/translation:

 translateAnalyse = {
 	-- other language codes alphabetically before 'code'
 	['code'] = "your translation",
 	-- other language codes alphabetically after 'code'
 },
 translateHistory = {
 	-- other language codes alphabetically before 'code'
 	['code'] = "your translation",
 	-- other language codes alphabetically after 'code'
 },

Hiányzó nyelv

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 read from Module:OSM Constants or mw.language.fetchLanguageName(pageLanguage, 'en').

Tervezési döntések

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"?
Template:State provides a more detailed way of documenting mapping statuses.
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, this would result in an even bigger increase.