Template:Lang links subst

Template documentation[view · edit · history · purge]
This documentation is transcluded from Template:Lang links subst/doc.
Category:Main message boxes

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

Usage

Category:Main message boxes Category:Templates which must be substituted#Lang%20links%20subst

{{subst:lang links subst |1= }}

{{subst:lang links subst}} with edit summary Updating using [[Template:Lang links subst|{{subst:lang links subst}}]]

Template parameters

ParameterDescriptionDefaultStatus
1Page 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.

Category:Templates not requiring internationalization

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 &nbsp; or &#32; (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.

Category:Internal link templates#Lang%20links%20subst
Category:Internal link templates Category:Templates not requiring internationalization Category:Templates which must be substituted