Template:Lang links subst
<>
PAGENAME}}]]</includeonly> <>
Note: The full template is only visible on transclusion and hidden from view on this page. |
This template is the substitution version of {{Lang links}}. It's meant to be subst'd on /lang pages. It can be used to add all available translation links and format them correctly all in one step. Simply replace the whole page (including the <noinclude> part) with {{subst:lang links subst}}
.
This only works for pages whose translation subpages follow the standard naming convention of "../language_code".
The template automatically sets the following categories: Category:Language link templates
Contents
Usage
This template must be substituted using {{subst:lang links subst}} instead of {{lang links subst}} .Maintenance: Check for un-substituted usage. |
{{subst:lang links subst |1= }}
{{subst:lang links subst}} with edit summary Updating using [[Template:Lang links subst|{{subst:lang links subst}}]]
Template parameters
Parameter | Description | Default | Status | |
---|---|---|---|---|
1 | Page name of the page that's subpages provide the translation | {{NAMESPACE}}:{{BASEPAGENAME}} | optional |
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
See also
Localization
This template is not intended to be localized.
Technical information
The empty comments are necessary for making new lines inside the {{#ifexist:}}; they also supply the spaces after the links (in MediaWiki, a single carriage return will not create a line break). This method is used instead of another or   (non-breaking space and regular space) to make the source easier to read when viewed directly.
Substitution leaves no templates, "magic word" variables, or parser functions behind except a {{#language:}} for each link and one {{Edit}} (for the +/- edit link). This is to reduce server stain and not count much towards any pre-processor/post-expand limits, specifically the expensive parser function count—the whole reason for using this instead of the maintenance-free {{Lang links}}. The unsubst'd version contains 101 #ifexist functions out of the maximum of 500 allowed. This number of #ifexists will continue to grow as new languages are added; they are usually added as soon as one translation in that language appears on Commons. The limit may also decrease in the future (there was talk of reducing it to 100).
It's very important for "/lang" pages to be as light as possible on the servers because they are generally transcluded in a template, or group of templates, which are then transcluded wherever that template is used. Many, such as license templates, are used on a lot of pages. It doesn't matter if the template itself is subst'd (like with user messages) because the {{.../lang}} inside of it isn't. Recursive substitution should never be used either because it will make a huge mess. All kinds of templates and pages have language links so it's never known if those extra ∼100 may be needed. If, let's say, 5 user message templates that all use {{lang links}} are placed on a talk page (subst'd or not), that page will be above the limit. Using this template avoids all of that.