Page semi-protected

Template:Localized media

From Wikidata
Jump to navigation Jump to search

File:Example.png

Documentation icon Template documentation[view · edit · history · purge ]

Purpose

This template is used to show localized images (and another media) in the language of the current page. Users can be create localized version of screenshots, diagramms etc., which the standartized form of filename Filename langcode.file_extension (e.g. File:Sysopdeleteform el.png), where "code" is a valid language code. In various cases, the language code can be separated by different delimiter characters.

The template first checks "content language" of the current page (this check based on pagename suffix, e.g. Template:Sysophelp/doc/el; this indicating that it is translated). Then it checks if the filename given as a first parameter has a translation in that language (e.g. File:Sysopdeleteform el.png).

If the current page name is not suffixed with a valid language code, or if the localized file doesn't exist in that language, it will display the file with base filename (e.g. File:Sysopdeleteform.png).

Parameters

This template is used to show localized images (and another media) in the language of the current page.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
file name1 filename

Image filename, without extension, language code and delimitation symbol

Linerequired
extension2 ext

File extension

Default
png
Lineoptional
delimitation3 delim

Delimitation symbol for language code

Default
(space)
Lineoptional

How to use

  • {{Localized media | filename without extension | file extension}}
  • {{LM | filename without extension | file extension}}
  • {{lm | filename without extension | file extension}}

If the file extension is not specified, png is used by default.

Example 1

(from Help:Description):

{{Localized media | Wikidata layout Phase I | png}} or {{LM|Wikidata layout Phase I|png}}
{{LM | Wikidata layout Phase I | png}}

which includes translated versions of “File:Wikidata layout Phase I.png” (such as “File:Wikidata layout Phase I de.png” for German) if it exists in the same language as the current page, or the base (most often English) version if such translation doesn't exist in that language.

Example 2

{{Localized media | Wikipedia-logo-v2 | svg | -}} or
{{LM | Wikipedia-logo-v2 | svg | -}} or
{{LM |filename = Wikipedia-logo-v2 |ext = svg |delim= -}}

which includes translated versions of “File:Wikipedia-logo-v2-en.svg” (such as “File:Wikipedia-logo-v2-de.svg” for German).

Note

This cross-wiki template. These same code is used at the: