Template:Lang/sandbox
This is the template sandbox page for Template:Lang (diff). |
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 en français. It should still appear on the same line, though.
- Block elements are useful for structuring stuff.Manchmal müssen sie in ihrer Gesamtheit als deutschsprachig ausgezeichnet werden.Oder auch mehrere.So you see, it’s not all that simple.
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:
|
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:
See also
{{Language}}
Localization
This template is not intended to be localized.
The above documentation is transcluded from Template:lang/sandbox/doc (edit | history). Editors can experiment in this template's sandbox (edit | diff) and testcases (create) page. Subpages of this template. |