Template:Translatable template name

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]

This template is used to return the name of translatable templates in the language of the current page. Templates, like all other MediaWiki pages, can be translated using the Translate extension, which creates subpages with the form “pagename/language code”. The template first checks if the name of the current page contains a language code. If it does, it then checks if the template name given as a first parameter has a translation in that language. If the page name does not contain a language code, or if the navigation template doesn’t exist in that language, it will display the English template.

Usage

{{Translatable template name |1= }}

Or use the shorthand

  • {{ {{Translatable template name|name of navigation template}}|parameters....}}
  • {{ {{TNTN|name of navigation template}}|parameters....}}
  • {{ {{tntn|name of navigation template}}|parameters....}}

Example (from translatable Template:Meta, used in translatable page Meta:About):

{{Translatable template name|Tnavbar}} or {{TNTN|Tnavbar}}

which returns the translated versions of {{Tnavbar}} if it exists, or the English version if translations don't exist.

Template parameters

<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

This template is used to return the name of translatable templates in the language of the current page. Templates, like all other MediaWiki pages, can be translated using the Translate extension, which creates subpages with the form “pagename/language code”. The template first checks if the name of the current page contains a language code. If it does, it then checks if the template name given as a first parameter has a translation in that language. If the page name does not contain a language code, or if the navigation template doesn’t exist in that language, it will display the English template.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
template name1

The name of the template to get translations for. Required unless “noshift” parameter is used, in which case it’s ignored.

Templatesuggested
namespacenamespace

Namespace to get translations for.

Default
Template
Lineoptional
no shiftnoshift

Use “template” parameter for template name instead of unnamed parameter 1. It’s used in {{TNT}} to avoid shifting all unnamed parameters, and included here for the sake of consistency. It doesn’t make much sense in this template, though.

Linedeprecated
template name (no shift)template

The name of the template to get translations for. Required if “noshift” parameter is used, otherwise ignored.

Templatedeprecated
desired languageuselang

The language the template should be translated into, by default the language of the current page. If this template doesn’t exist, the template falls back to use English.

Lineoptional

Additional information

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

The template is intended to be used by the following user groups: no user group specified

Relies on:

See also

Localization

This template is not intended to be localized.