Template:Lang links/doc

From "PTTLink Wiki"
Jump to navigation Jump to search

Shows which language versions of a page exist.

Usage

{{Lang links |1= }}

This template shows which language versions of a page exist (based on the naming scheme ../xx, with xx the language code), and provides links to them. For example:

Template:Xpdoc

Compare:

Template:Xpdoc

(based on Special:Prefixindex), which does not distinguish between a postfix for a language and other postfixes such as /doc and /layout. Another difference is that the language code is shown, rather than the local name.

This template should not be used on templates to avoid hitting the "expensive parser function" or the "LUA execution time" limit on pages with other expensive templates. If your template needs language links, create a /lang subpage, transclude it to the template and regularly update it using {{subst:lle}}. Never use this template directly or indirectly on templates intended for the file namespace that will likely stay there for a long time.

Performance: This template makes use of different approaches to be fast and correct. First, it evaluates all subpages of the page it show the language links for. If this takes too long, it switches to another approach: It checks, for each language, whether a page in that language exists. Therefore: If can avoid that your page gets a lot of subpages, this template's performance will be superior. Technical details and talk at Template talk:Lang links#Using LUA.

Template:Ll will generate the same results but must be substituted.

Template parameters

ParameterDescriptionDefaultStatus
1Page name of the page that's subpages provide the translation{{NAMESPACE}}:{{BASEPAGENAME}}optional
addlinkprovide an alternative add-link or whatever you like right after the language links{{edit|{{NAMESPACE}}:{{BASEPAGENAME}}/lang}}optional
suppressaddlinkallows to remove the +/- -linkemptyoptional
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. <nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

Discussion
There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.


Wikipedia's help about TemplateDataCommons-specific information

Shows which language versions of a page exist.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
1

Page name of the page that's subpages provide the translation

Default
{{NAMESPACE}}:{{BASEPAGENAME}}
Unknownoptional
addlink

provide an alternative add-link or whatever you like right after the language links

Default
{{edit|{{NAMESPACE}}:{{BASEPAGENAME}}/lang}}
Unknownoptional
suppressaddlink

allows to remove the "+/-" -link

Unknownoptional

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: all users

Relies on:
Module:Languages, Module:Languages/List, Module:Page

⧼Seealso⧽

{{Ll}}, {{Lle}}, {{lang links cheap}}

Localization

This template is not intended to be localized.