Template:Lang/sandbox

From Wikidata
Jump to navigation Jump to search

Note: The test for block content resulted in “000000”.

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

Using this template, a specific language code can be specified in the HTML code.

Usage

{{Lang|1=|2=}}

This template applies the “lang” attribute to either a “span” or a “div” tag as needed (or another tag if specified), which is then used to wrap the text. It also adds CSS classes, that for example allow CSS highlighting text that is in a specific language. For a list of language codes to use for parameter 1 see List of ISO 639-1 codes.

This template (the production version, not this sandbox version) is for example called from autotranslatable templates. Wikidata, like Commons and other multilingual Wikimedia projects, thus requires support for this template on both blocks of text and inline strings of text. “div” works for text blocks, but “span” is necessary for any inline uses of this template.

The following examples demonstrate this template at work in both inline and block contexts:

Example sentence that is partially Note: The test for block content resulted in “000000”.en français. It should still appear on the same line, though.
Block elements are useful for structuring stuff.
Note: The test for block content resulted in “000000”.
Manchmal müssen sie in ihrer Gesamtheit als deutschsprachig ausgezeichnet werden.
Oder auch mehrere.
So you see, it’s not all that simple.
Note that block elements can also be introduced by wiki markup:

Note: The test for block content resulted in “000000”.Es kommen jetzt Blöcke:

  • Dies ist ein Block.
  • Dies ist noch einer.

Parameters

Parameter name Description Default value required or optional?

parameter #1 (1) used language code in ISO 639-1 (two-letter) format empty required
parameter #2 (2) Text in the used language code empty optional
tag Possible HTML tags:
div
Text as a separate division
span
Text within a text flow
heuristic guess based on whether the text seems to contain block elements optional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

Relies on:
Template:Lang/sandbox-core

Example

{{Lang|1=de|2=Dies ist ein Beispiel.}}

renders as:

{{{2}}}

See also

Localization

This template is not intended to be localized.