Template:LangSwitch/doc

Aus Wikimedia Commons, dem freien Medienarchiv
Zur Navigation springen Zur Suche springen

Diese Unterseite enthält Dokumentation, Kategorien sowie weitere Informationen, die nicht zur Vorlage gehören.
Siehe Template:LangSwitch für die Vorlage selbst.


العربية  asturianu  Boarisch  беларуская (тарашкевіца)  български  বাংলা  català  čeština  dansk  Deutsch  Zazaki  Ελληνικά  English  Esperanto  español  eesti  euskara  فارسی  suomi  français  galego  עברית  हिन्दी  hrvatski  magyar  Bahasa Indonesia  italiano  日本語  ქართული  한국어  Lëtzebuergesch  македонски  മലയാളം  ဘာသာ မန်  Bahasa Melayu  Mirandés  မြန်မာဘာသာ  norsk bokmål  Plattdüütsch  Nederlands  norsk  polski  português  português do Brasil  русский  sicilianu  Scots  slovenščina  српски / srpski  svenska  ไทย  Türkçe  українська  اردو  oʻzbekcha  Tiếng Việt  简体中文  繁體中文  +/−

(Dieser Teil der Dokumentation ist nur in manchen Sprachen verfügbar.)

Provides a method to present a string of text selected from an array of many language translations in the language set in the user's preferences or the most appropriate fallback language.

Diese Vorlage kategorisiert automatisch in die folgenden Kategorien: Category:Internationalization templates using LangSwitch

Verwendung

{{LangSwitch
 |en =
 |xx =
 |default =
}}

Vorlagenparameter

<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData ist eine Möglichkeit, Informationen über Vorlagenparameter (deren Beschreibung und die gesamte Vorlage) in für Menschen und Maschinen lesbarer Form zu speichern. Diese Technik wird vom VisualEditor und anderen Werkzeugen wie Upload Wizard genutzt.


Bestehende Vorlagendokumentation
In den Wikimedia Commons, wird empfohlen {{TemplateBox}} mit entweder ‎useTemplateData=1 oder ‎useTemplateData=only auf der ‎/doc-Unterseite zu benutzen und es mit {{Documentation}} in eine Vorlage zu transkludieren. ‎<nowiki>-Etiketten können, soweit erforderlich, um die Argumente gehüllt werden, um zu vermeiden, dass die Vorlagen expandiert werden.

Neu erstellte Vorlagendokumentation und -importe
Eine weitere Möglichkeit, insbesondere für importierte Vorlagen oder für Benutzer mit JSON-Erfahrung, ist das Einfügen von Original ‎<templatedata>-Tags in den Wikitext der Vorlage, wie in verschiedenen Wikipedias beschrieben.

Diskussion
Es gibt aktuell eine Diskussion hierüber. Du bist eingeladen Kommentare abzugeben, wenn Du hier sachkundig bist, wenn es Deine Zeit erlaubt und Du Deine Meinung mit anderen austauschen oder einen Vorschlag anbringen möchtest.


Wikipedia-Hilfe über TemplateDataCommons-spezifische Informationen

Provides a method to present a string of text selected from an array of many language translations in the language set in the user's preferences or the most appropriate fallback language.

Vorlagenparameter

Diese Vorlage bevorzugt Blockformatierung von Parametern.

ParameterBeschreibungTypStatus
Default Fallbackdefault

Default text in case one of the "xx" languages is not the language of user's preferences. By default, the English version will be shown, if provided.

Standard
{{{en|}}} (English version)
Mehrzeiliger Textvorgeschlagen
Englishen

Text in English language. Unless ''default'' option is used, this text will also be used if the languages provided do not include the language set in the user's preferences. If you do not want to show any text when the user's language is English, then use "en=~".

Mehrzeiliger Texterforderlich
Language Codelang

Sprachversion (muss nur angegeben werden, wenn die angezeigte Sprache unabhängig von der in den Benutzereinstellungen festgelegten Sprache gesetzt werden soll). {{#if:{{{lang|}}}|{{{lang}}}|{{int:Lang}}}} is not necessary.

Standard
Value of {{int:Lang}} (the preferred language of the visitor viewing the page).
Mehrzeiliger Textoptional
No Category?nocat

"nocat=1" will overwrite the default behavior of tracking uses without "en" or "default" options.

Mehrzeiliger Textoptional
xx

Translated text in language ''xx'' (the parameter name ''xx'' can be any supported language code (from BCP 47/ISO 639-1), and you can specify as many such parameters as needed for each translated language). Use "xx=~" if you do not want any message (or default) in some specific language. You can map multiple languages to a single text by using "{{LangSwitch|xx/yy/zz=text}}" which is equivalent to "{{LangSwitch|xx=text|yy=text|zz=text}}" .

Mehrzeiliger Textoptional

Weitere Informationen

Diese Vorlage ist für die folgenden Namensräume gedacht: Kein spezieller Namensraum angegeben

Diese Vorlage ist für die folgenden Benutzergruppen gedacht: alle Benutzer

Diese Vorlage ist abhängig von:
Module:Fallback

Siehe auch

(Dieser Teil der Dokumentation ist nur in manchen Sprachen verfügbar.)

Übersetzung in lokale Sprachen

Diese Vorlage soll nicht in lokale Sprachen übersetzt werden.

(Dieser Teil der Dokumentation ist nur in manchen Sprachen verfügbar.)

Help for choosing the right template for your use case:
I18n templates: {{Multilingual description|lang=
|de,en,default=Deutsch/​English
|fr=français
|...
}}
{{de|Deutsch}}
{{en|English}}
{{fr|français}}
...
{{LangSwitch|lang=
|de,en,default=Deutsch/​English
|fr=français
|...
}}
{{Autotranslate}} {{tnt}} Language-aware transclusion
Recommended use at Categories, galleries File description pages (deprecated, can be safely replaced by {{Multilingual description}}) Small templates, whenever the previous options are not suitable (removes the visual indication of the language before each translated text) Data tables with translated cells or larger templates, when used on pages that do not have language subpages (e.g. not having Main page/en, Main page/de) and where the language displayed will be automatically determined by the language set in user preferences Data tables with translated cells or larger templates, when used on pages that do have language subpages; most of the time these will be pages prepared with the Translate Extension Data tables with translated cells or larger templates, when used on pages that do have language subpages; the transcluded page needs to be prepared with the Translate Extension, the transcluding page needs to be either prepared with the Translate Extension, or have the page language set by a translation administrator
Requires JavaScript enabled for folding Yes No
Folding can be disabled by user Yes No
Folding is done server-side No Yes
Folding when at least n languages are provided 1 (all translations are shown without folding if the preferred language selected by the user has no matching translation) 4 1
Detection of duplicate, incorrect, or unsupported language codes Yes No Yes Duplicate language codes are impossible by design. Incorrect or unsupported codes are never displayed, but not reported. The Translate extension's interface (if it's used on the translation subpages) doesn't let the user create translations with invalid codes, but other methods (e.g. entering the translation's URL directly) allow it without any warning.
Allows the same translation to be used for several languages Yes No Yes
Supports language fallbacks No Yes No
Collation order of languages (when not folded) Consistent order by native language name, languages grouped by script:
  • LTR scripts: Latin, Latin or Cyrillic, Cyrillic, Greek, other simple LTR alphabets (Armenian, Georgian, etc.), abugidas (North Indian, South Indian, other South-East Asian, etc.), syllabaries (European, American, African, Asian), Korean alphabets (basic Jamos, Hangul including some sinograms), Japanese syllabaries (including some sinograms), sinograms (including some syllabaries)
  • RTL scripts: Hebrew, Arabic, other RTL abjads (Divehi, etc.), RTL syllabaries (N'ko)
As provided by the user in the wikitext (any inconsistent order may be difficult to lookup visually) N/A
Search indexing issues No (all translations are included on the same page, however search results may be less relevant with many languages mixed) Yes (may not index all languages depending on search engines, unless there's a list of links for visiting other languages) Partially (where used; language subpages of templates are indexed) No (translated pages should include a <languages/> navigation bar for visiting other languages)
Page size issues Yes (may exhaust size or time limits in the wiki parser if many languages are included; larger pages to download for all visitors; slower navigation for visitors with slow Internet access; may be costly for visitors with limited data plans) No (only the content for the selected language or a suitable fallback language is present in the generated page)
Contains expensive parser functions No Yes, checks for several translations along the fallback chain until finds a suitable Yes, 2–4 checks per call No

Examples

Without a default option

Here are a few examples showing template behavior for three languages: English, Italian and Corsu, which defaults to Italian if Corsu text is not available:

Test Code lang=en lang=it lang=co
No en; default {{LangSwitch|it=Italian|default=default}} default Italian Italian
No en; no default {{LangSwitch|it=Italian|co=Corsu}} LangSwitch Error: no default[1] LangSwitch Error: no default[1] LangSwitch Error: no default[1]
en; default {{LangSwitch|en=English|co=Corsu|default=default}} English default Corsu
en; no default {{LangSwitch|en=English|co=Corsu}} English English Corsu
en; skip default {{LangSwitch|en=English|co=Corsu|default=~}} English Corsu
en; empty default {{LangSwitch|en=English|co=Corsu|default=}} English English Corsu
Skip en; default {{LangSwitch|en=~|it=Italian|default=default}} Italian Italian
Skip en; no default {{LangSwitch|en=~|it=Italian}} Italian Italian
Empty en; no default {{LangSwitch|en=|it=Italian}} LangSwitch Error: no default Italian LangSwitch Error: no default
en; default; skip it {{LangSwitch|en=English|it=~|co=Corsu|default=default}} English Corsu
en; default; empty it {{LangSwitch|en=English|it=|co=Corsu|default=default}} English default Corsu
en; no default; skip it {{LangSwitch|en=English|it=~|co=Corsu}} English Corsu
Forced "lang=co" {{LangSwitch|en=English|co=Corsu|default=default|lang=co}} Corsu Corsu Corsu

Example for more

<kbd>LangSwitch|de=Grün|es/it/pt=Verde|fr=Vert|en=Green |lang={{{lang|{{int:lang}}}}}}}</kbd> will give Grün for language de


red
(Rot)
bleu
(Blau)


This example will translate red when not English, and bleu when not French

Default option

The default option is intended for providing more language independent option. For example:

{{LangSwitch
|de={{Wd|Warschau}}
|en={{W|Warsaw}}
|fr={{Wf|Varsovie}}
|ja={{W日|ワルシャワ}}
|pl={{WP|Warszawa}}
|ru={{Wr|Варшава}}
|default=[[d:Q270]]
}}

will provide link to Wikipedia articles in case one of the languages provided matches user's language but will link to Commons gallery page (Warsaw) if any other language is used. The expression {{W|Q270||d}} is equivalent to the shorter [[d:Q270]] (it just does not show the "d:").

Warning

This template SHOULD NOT be used out of software interface purpose. For example it SHOULD NOT be used to manage multilingual description of the subject of a media or a category or whatsoever.

Notes

  1. a b c would add Category:LangSwitch template without default version