This is a documentation subpage for Template:Hu:Relation.|
It contains usage information, categories and other content or metadata that is not part of the original template.
|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]
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|
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.
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:
- user input
- dedicated language namespace
- language title prefix
- '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 = true -- only if you provide both translations, otherwise leave this line out
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).
- 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).
- , ,
- , ,