Template:Ls/doc

From Meta, a Wikimedia project coordination wiki

Usage[edit]

<div class="multilingual">
{{ls|en|This text is English}}
{{ls|fr|Ce texte est en français}}
{{ls|it|Questo testo è Italiano}}
{{ls|nl|Deze tekst is in het Nederlands}}
{{ls|el|Αυτό το κείμενο είναι στα Ελληνικά.}}
</div>
English: This text is English
Français : Ce texte est en français
Italiano: Questo testo è Italiano
Nederlands: Deze tekst is in het Nederlands
Ελληνικά: Αυτό το κείμενο είναι στα Ελληνικά.

This template wraps translations for Language select, a script which dynamically hides languages when the user's preferred language is available.

Parameters[edit]

Suppressing the leading label of the language name
To suppress the language name heading the content (because it is already part of it):
<div class="multilingual">
{{ls|en|This new text is '''English'''.|label=no}}
{{ls|fr|Cet ancien texte est en '''français'''.|label=no}}
{{ls|it|Questo vecchio testo è '''Italiano'''.|label=no}}
{{ls|nl|Deze oude tekst is in het '''Nederlands'''.|label=no}}
</div>
This new text is English.
Cet ancien texte est en français.
Questo vecchio testo è Italiano.
Deze oude tekst is in het Nederlands.
Outdated translations
To mark a translation as outdated:
<div class="multilingual">
{{ls|en|This new text is English.}}
{{ls|fr|Cet ancien texte est en français.|update=en}}
{{ls|it|Questo vecchio testo è Italiano.|update=en}}
{{ls|nl|Deze oude tekst is in het Nederlands.|update=en}}
</div>
English: This new text is English.
Français : Cet ancien texte est en français. [update needed : en]
Italiano: Questo vecchio testo è Italiano. [update needed: en]
Nederlands: Deze oude tekst is in het Nederlands. [update needed: en]
Customize appearance
To customize the appearance using CSS:
<div class="multilingual">
{{ls|en|This text is English.|CSS-box=background:#000; color:#FFF;}}
{{ls|en|This text is English.|CSS-label=background:#000; color:#FFF;}}
{{ls|fr|Ce texte est en français.|CSS-box=background:#000; color:#FFF;}}
{{ls|fr|Ce texte est en français.|CSS-label=background:#000; color:#FFF;}}
{{ls|it|Questo testo è Italiano.|CSS-box=background:#000; color:#FFF;}}
{{ls|it|Questo testo è Italiano.|CSS-label=background:#000; color:#FFF;}}
{{ls|nl|Deze tekst is in het Nederlands.|CSS-box=background:#000; color:#FFF;}}
{{ls|nl|Deze tekst is in het Nederlands.|CSS-label=background:#000; color:#FFF;}}
</div>
English: This text is English.
English: This text is English.
Français : Ce texte est en français.
Français : Ce texte est en français.
Italiano: Questo testo è Italiano.
Italiano: Questo testo è Italiano.
Nederlands: Deze tekst is in het Nederlands.
Nederlands: Deze tekst is in het Nederlands.
Use of span boxes
To mark a translation in a header:
<div class="multilingual">
{{ls|en|This new text is English.|label=no|tag=span}}
{{ls|it|Questo vecchio testo è Italiano.|label=no|tag=span}}
</div>

This new text is English. Questo vecchio testo è Italiano.

Translation[edit]

To translate the "update needed" message, edit {{snippets/update needed}}.

Workaround if the translation contains an equal sign (because of URLs or custom HTML tags)[edit]

If the translation contains an equal sign, possibly inside an URL, it will cause the text to not show up (phab:T16235). To workaround that, use the following syntax: precede the language parameter with 1=, and the text parameter with 2=.

In the following examples, the first one won't display correctly because of the equal sign of the URL. The second one uses the workaround to fix the issue.

<div class="multilingual">
{{ls|en|Example URL: http://example.com/?p=1|label=no}}
{{ls|1=en|2=Example URL: http://example.com/?p=1|label=no}}
</div>
{{{2}}}

See also[edit]