Template:Multilingual description

From "PTTLink Wiki"
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
File:2014-03-01 Gadget Language Select on Template Mld Win7.png
The HTML form-select element is created by a JavaScript gadget

This template allows you to write descriptions in different languages, and to display only the one that is set in the user preferences. It also allows you to select and display a different language using a drop-down form.

Usage

{{Multilingual description |xx= }}

Or use the shorthand Mld

For the creation of the form-select and folding of languages, JavaScript is required. This JavaScript is implemented as default gadget at Wikimedia Commons, namely “Language select”, and can be switched off amending the preferences. (Template:ActivateGadget // Template:DeactivateGadget)

The gadget will also fold descriptions in multiple languages and create a form-select, if more than a threshold are written consecutively on a page, using language templates like {{en}}, {{fr}} and {{es}}. However, if the text and the corresponding language code to display (for example, "en") is not listed in the template, all of the other languages listed in the template will be displayed instead, by default.

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}}
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
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
Allows the same translation to be used for several languages Yes No Yes
Supports language fallbacks No Yes No Yes
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 (unless there's an editable /lang subpage listing all the existing translations selected with a {{LangSwitch}})

Template parameters

ParameterDescriptionDefaultStatus
xxxx can be any number of any supported language codesemptyoptional

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

Placement: At the top of the page

Relies on:

⧼Seealso⧽

Localization

This template is not intended to be localized.

Example

{{Multilingual description
 | be-tarask = '''Беларускі''' тэкст. Калі няма тэксту на адпаведнай мове, дапомна будуць адлюстраваныя тэксты на ўсіх мовах.
 | ca = texto en '''català'''.
 | de = '''deutscher''' Text.
 | diq = No nuşte Zazakiyo.
 | en = '''English''' text, if the text corresponding to the chosen language to display is not available, all languages will be displayed by default.
 | fr = texte '''français''', si le texte correspondant à la langue choisie n’est pas disponible, toutes les langues seront affichées par défaut.
 | it = Testo '''italiano'''.
 | ja = 日本語の文字。もし選択した言語に対応したテキストが正しく表示されない場合、デフォルトで全ての言語で表示されます。
 | mk = Текст на '''македонски'''. Ако нема текст што соодветствува на одбраниот јазик, тогаш по основно ќе се прикажат сите јазици.
 | pt = Texto em '''português'''.
 | pt-br = texto em '''português do Brasil''', se o texto correspondente ao idioma escolhido não estiver disponível, o texto será exibido por padrão em todos os idiomas disponíveis.
 | ru = '''Русский''' текст.
 | uk = '''Український''' текст. Якщо немає тексту на відповідній мові, за замочуванням будуть відображені тексти на всіх мовах.
 | zh = '''中文'''文本,如果選擇顯示的語言對應的文本不可用,則默認顯示所有語言。
}}

produces:

Català: texto en català.
Deutsch: deutscher Text.
English: English text, if the text corresponding to the chosen language to display is not available, all languages will be displayed by default.
Français: texte français, si le texte correspondant à la langue choisie n’est pas disponible, toutes les langues seront affichées par défaut.
Italiano: Testo italiano.
Português: Texto em português.
Português do Brasil: texto em português do Brasil, se o texto correspondente ao idioma escolhido não estiver disponível, o texto será exibido por padrão em todos os idiomas disponíveis.
Zazaki: No nuşte Zazakiyo.
Беларуская (тарашкевіца)‎: Беларускі тэкст. Калі няма тэксту на адпаведнай мове, дапомна будуць адлюстраваныя тэксты на ўсіх мовах.
Македонски: Текст на македонски. Ако нема текст што соодветствува на одбраниот јазик, тогаш по основно ќе се прикажат сите јазици.
Русский: Русский текст.
Українська: Український текст. Якщо немає тексту на відповідній мові, за замочуванням будуть відображені тексти на всіх мовах.
日本語: 日本語の文字。もし選択した言語に対応したテキストが正しく表示されない場合、デフォルトで全ての言語で表示されます。
中文: 中文文本,如果選擇顯示的語言對應的文本不可用,則默認顯示所有語言。