This page is protected against editing.

Template:Lang links

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

English  +/−

Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Lang links/doc.

Shows which language versions of a page exist. The template first looks for /lang subpage and if found transcludes it, if /lang subpage does not exist it searches thru chosen number of most used languages and tests if they exist. Displaying languages for templates without /lang is expensive and might land the page in Category:Pages with too many expensive parser function calls, it also might miss subpages for rarely used languages. Create /lang subpage to avoid this issue.

Usage

{{Lang links |1= |num_lang= }}

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:

{{lang links|Template:No source since}}العربية  беларуская (тарашкевіца)  български  català  čeština  dansk  Deutsch  Deutsch (Sie-Form)  Ελληνικά  English  español  فارسی  suomi  français  galego  hrvatski  magyar  Bahasa Indonesia  italiano  日本語  Bahaso Melayu Jambi  ಕನ್ನಡ  한국어  македонски  മലയാളം  မြန်မာဘာသာ  norsk bokmål  Nederlands  norsk nynorsk  norsk  polski  português  português do Brasil  русский  sicilianu  slovenčina  slovenščina  svenska  Türkçe  українська  简体中文  繁體中文  +/−

Compare:

{{lang links cheap|Template:No source since}}

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

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
num_langMaximum number of languages to test. In order to prevent page using the template from landing in Category:Pages with too many expensive parser function calls or showing Lua errors one can only search through top 20, 50, 70, 100, etc. languages. in 2024 a language ranking study analyzed subpages of 2400 templates and counted language subtemplates for each language. Than about 120 languages were ranked based on number of subpages. This option allows you to only test for most likely languages.70optional
<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.


Wikipedia's help about TemplateDataCommons-specific information

Shows which language versions of a page exist. The template first looks for /lang subpage and if found transcludes it, if /lang subpage does not exist it searches thru chosen number of most used languages and tests if they exist. Displaying languages for templates without /lang is expensive and might land the page in [[:Category:Pages with too many expensive parser function calls]], it also might miss subpages for rarely used languages. Create /lang subpage to avoid this issue.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
1

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

Default
{{NAMESPACE}}:{{BASEPAGENAME}}
Unknownoptional
num_lang

Maximum number of languages to test. In order to prevent page using the template from landing in [[:Category:Pages with too many expensive parser function calls]] or showing Lua errors one can only search through top 20, 50, 70, 100, etc. languages. in 2024 a language ranking study analyzed subpages of 2400 templates and counted language subtemplates for each language. Than about 120 languages were ranked based on number of subpages. This option allows you to only test for most likely languages.

Default
70
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:Lang links

See also

Localization

This template is not intended to be localized.