Template talk:Description

From Wikimedia Commons, the free media repository
Jump to: navigation, search
Info non-talk.svg Template:Description has been protected indefinitely because it is a highly-used or visible template. Use {{Edit request}} on this page to request an edit.

Class attributes[edit]

Why are there class attributes in the template? --kahusi (會話) 11:00, 6 February 2006 (UTC)

You can use CSS to hide text in languages you don't know. See User:Dbenbenn/monobook.css, for example, which hides everything except English. User:dbenbenn 18:46, 6 February 2006 (UTC)

I see. Thank you. --kahusi (會話) 11:31, 7 February 2006 (UTC)

HTML / XML[edit]

IMHO it should say <p lang="{{{1}}}" xml:lang="{{{1}}}">, the xml:lang attribute is missing. Can somebody please confirm and then change? --Chrislb 19:15, 20 October 2006 (UTC)

ISO code or language name?[edit]

When and where was it decided that native language name (using {{#language:) will be displayed by the i18n templates?? The change was done by User:Sanbec on 2006-06-08, marked as minor (!) and saved without an edit summary (!), but the only relevant prior discussion I can find is Commons talk:Templates for galleries, where the result was clear: “The clear majority is in favour of using ISO language codes as plain text and the language templates should be modified to reflect this outcome.” Then, a “cool new magic word” came out, and the template was changed. I don’t think this was a correct step. --Mormegil 16:51, 6 November 2006 (UTC)

Adding an 'inline' parameter to remove span tags[edit]

I added a 6th parameter that enables the template to not break the current paragraph. Any value different from an empty string makes it inline, so that several descriptions can be put side by side on a single line.
-- AlNo (talk) 14:48, 26 January 2007 (UTC)

Tweak for multi-paragraph descriptions[edit]

I noticed there's a {{Description-begin}} template that was created because this one doesn't work properly with multiple paragraphs, and wondered if instead this template could be fixed. I've made a version at User:Davepape/Description which seems to work (see test at User:Davepape/En). However, not having experience with template coding, I don't want to edit this heavily used one without others confirming whether the change is correct. For one thing, my version produces an ugly mess when you view the template page itself; I know that can be hidden with includeonly, but don't know if it indicates a flaw in my template, or if it's an ignorable MediaWiki bug. Any comments? --Davepape 18:35, 6 March 2007 (UTC)

You still have <span> around the second param. There would probably have to be 3x#if. --Nux (talk··dyskusja) 01:51, 7 March 2007 (UTC)
I think, I fix it in User:Davepape/Description. Cordially, Educa33e 11:33, 7 March 2007 (UTC)
Nux - If you're suggesting that the internal spans should also optionally be divs - I didn't do that because I saw that {{Description-begin}} uses span. Although my reading of the html definition implies that div ought to be used for multi-paragraph blocks, in my tests, div introduced an unwanted line break while span worked fine. (Note that I can only test with Firefox & Safari; I don't know what things look like in Explorer.) I see that Educa33e has gone ahead and changed the template, so I guess we'll find out if there's any problem. --Davepape 14:51, 7 March 2007 (UTC)
Hm... I always thought that span elements shouldn't contain block elements, but as seems I was wrong (just checked the specs again)... So I think your fix will be OK. --Nux (talk··dyskusja) 23:14, 7 March 2007 (UTC)

Please fix the template so that the desc in Image:Oxygen atmosphere.png will be presented correctly. Yonidebest Ω Talk 17:58, 5 June 2007 (UTC)

We need to use div only, not span[edit]

Span in this template is breaking ordered lists in pages like this: Image:BauchOrgane wn.png. It's because the devs upgraded HTML Tidy, and according to user:Gmaxwell, because templates like this use span instead of div.

This template kind of scares me, so if someone could remove the spans/convert them to divs, without breaking it, that would be good. thankyou. pfctdayelise (说什么?) 03:29, 13 April 2007 (UTC)

I believe the last span, around the main text, (<span class="text {{{1}}}" lang="{{{4|{{{1}}}}}}"> and its closer) can be simply removed. All it seems to do is add a "text" class, and I don't see anything like Commons:Multilinguality mentioning this as something with any potential use. The first, optional span is needed for inline uses of the template (since div creates a line-break); the second span should remain a span so as not to introduce a line-break between the language label and the text. Neither of these two spans should cause problems, since they're not meant to contain lists or other block-level stuff.
Removing the span appeared to work fine in my own test copy, so I've gone ahead and made the change, and will check various pages that use it, while the job queue settles back down. --Davepape 05:16, 13 April 2007 (UTC)

New version[edit]

Putting it here first in case there's any objections:

<{{#if:{{{inline|}}}|span|div}} class="description {{{1}}}" lang="{{{4|{{{1}}}}}}" dir="{{#switch:{{{1}}}|ar|dv|fa|ha|he|ug|ur|yi=rtl|ltr}}"><span class="language {{{1}}}" title="{{{name|{{{3|}}}}}}">'''{{#language:{{{1}}}}}{{{5|}}}:'''</span> {{{2}}}</{{#if:{{{inline|}}}|span|div}}>

-Rocket000 (talk) 09:38, 2 August 2008 (UTC)

minor change[edit]

At the moment the template has

</span> {{{2|}}}.

If I have a parameter 2 starting with a heading it won't be displayed (cause headings are only rendered if there are no other signs in the same line). A workaround is using <nowiki/> at the start of the parameter. But if the template would have


it would be rendered correctly without workarounds. This change shouldn't change anything except for headings (single line breaks are rendered as spaces by wiki markup and HTML, so there's no difference to "</span> {{{2|}}}"). Is it safe to change the template? I think so, but I will not risk to be lynched if I break all localization on Commons without asking before ;-) --Slomox (talk) 15:16, 21 December 2008 (UTC)

There's some problem with the new implementation - first item get to be broken in the new row. See Crepis paludosa (new, incorrect) vs. Crepis foetida (old, correct) for example of problem with Template:Translation table. --romanm (talk) 20:58, 2 January 2009 (UTC)
From an HTML point of view the edit didn't change anything. But it seems the wiki parser has a little inconsistency here. I have no idea whether this behaviour has a good reason or whether it is a bug. To me it seems like a bug.
The code

| <span><span>A:</span>

will be rendered as


instead of


I fixed it by changing Template:Lan. --Slomox (talk) 23:21, 2 January 2009 (UTC)
This change broke many lists which include language templates, since they can not contain line breaks in list items. For example if I want to use template:en in this comment (which is a definition list), I get:
English: The template text on a new line outside of the list.
There are lots of language templates in bullet lists that are now broken in the same way. /Ö 11:12, 3 January 2009 (UTC)

Change of class name[edit]

I have requested a change of name of a class, "description", used in this template. Please see the background at Template talk:Information#Clash of classes, and comment there to centralise discussion. Thank you. Andy Mabbett (talk) 20:26, 8 February 2009 (UTC)


Is there any specific reason, that prevents us from adding

style="direction: {{Dir|{{{4|{{{1}}}}}}}};"

to the template? That would automatically set the correct direction and would make {{Description/dir}} unnecessary. --Slomox (talk) 17:58, 7 May 2009 (UTC)

LTG language code's template[edit]

please correct CSS for template - {{ltg}}. That code ltg was transformed into Latgaļu, like here. Thanks --Dark Eagle (talk) 13:23, 6 March 2010 (UTC)

Scripts using the html attributes[edit]

Do we have a list of javascript scripts relying on the html attributes defined by this template?
I'd like to add the lang attribute for the lang label. I'd also like to rename its class to 'langlabel-' with the lang used.
The problem is that I don't know if the renaming of the parameter could have some impact on the existing javascript.
Esby (talk) 12:51, 23 April 2010 (UTC)

Instead of renaming the class you could keep the old class and add 'langlabel-xx' as an additional class. That won't break scripts (at least it will not break well-formed scripts and if it breaks not-well-formed scripts it's not your fault). --Slomox (talk) 20:00, 23 April 2010 (UTC)
Renaming the class is not really an issue, I can actually detect the actual class name, but it makes the code looking messier. What is the syntax to add an additionnal class ? (Feel free to edit user:esby/Description) Esby (talk) 21:42, 23 April 2010 (UTC)
You can place as many class names in the class parameter of an HTML tag as you want by separating them with a space: <div class="class1 class2 class3"></div>. --Slomox (talk) 09:03, 24 April 2010 (UTC)


Hi DieBuche. Before your change the "inline" mode allowed wiki paragraph breaks to be used (e.g. in Template:User admin/doc), but it does not anymore after you change. --AVRS (talk) 16:20, 16 October 2010 (UTC)

That was a side effect and it's not what inline is intended to do. If you want to achieve paragraphing in language templates, you can do it with a line break at the start of the parameter (you'll have to secure the line break with a <nowiki/> so it doesn't get stripped):

will render as


--Slomox (talk) 19:44, 16 October 2010 (UTC)
OK, thanks. --AVRS (talk) 11:46, 17 October 2010 (UTC)

External links[edit]

{{editprotected}} There appears a bug. If the text of the description contains an external link, the whole description doesn't display. --ŠJů (talk) 16:01, 1 November 2010 (UTC)

  Not done Negative, it works fine.
English: This is a description with an external link
It is difficult to help since you do not offer any example of your supposed bug, but I guess you are trying to use an external link containing a special character, most probably an equal sign (=), in which case you must use 2= as in the example above. --Mormegil (talk) 16:47, 1 November 2010 (UTC)
I have the problem with multilingual descriptions on two images i've just uploaded. See here and here. I do nothing special as i usually do but i doesn't work how i want it. Here it works fine, however... --Saviour1981 (talk) 18:11, 3 November 2010 (UTC)
Done! Found out what the problem was. No more help needed. Thanks anyway --Saviour1981 (talk) 18:40, 3 November 2010 (UTC)


Hi, this must done:

<includeonly><div class="description {{{1}}}" style="{{#if:{{{inline|}}}|display:inline;}} direction:{{Dir|{{{4|{{{1}}}}}}}};" lang="{{{4|{{{1}}}}}}"><span class="language {{{1}}}" title="{{{name|{{{3|}}}}}}">'''{{#language:{{{1}}}}}{{{5|}}}:'''</span> {{{2|}}}</div></includeonly>

by this way English (and other languages) description on RTL wikis can showed as LTR. this is needed.−ebraminiotalk 13:04, 4 March 2011 (UTC)

I changed it and it seems that it didn't break Commons and works as intended. --Slomox (talk) 14:21, 4 March 2011 (UTC)
thank you :) so as you said on #Direction Template:Description/dir can deleted now −ebraminiotalk 14:26, 4 March 2011 (UTC)
/dir usage on template namespace.−ebraminiotalk 22:50, 4 March 2011 (UTC)


{{edit protected}}

Please replace everything between the noinclude tags with {{documentation}}. I've already moved the relevant bits to Template:Description/doc. Rd232 (talk) 22:54, 30 June 2011 (UTC)

Really everything? Also the international.. cat? --Túrelio (talk) 17:46, 3 July 2011 (UTC)
Yes, everything. The correct approach (though widely ignored) is to put the category in the documentation page with includeonly tags. I've done that here. Rd232 (talk) 17:50, 3 July 2011 (UTC)
✓  Done . --ZooFari 19:54, 3 July 2011 (UTC)

Add Ewengki language[edit]

{{edit protected}} Please add Ewengki language (evn=ᠧᠸᠧᠩᠺᠢ). Its text uses {{MongolUnicode}}. --虞海 (talk) 08:53, 16 October 2011 (UTC)

  Not done This is not a page where a support for a new language can be added. Evenki is not supported by MediaWiki yet, you need to start MediaWiki localization to Evenki (see meta:Language committee/Handbook (requesters)#Localization) to have it supported by {{#language:evn}}). --Mormegil (talk) 11:05, 25 October 2011 (UTC)
I edited Template:Evn so it also displays the native name. But to get rid of the evn in it we indeed need a localisation (or some clever edit to Template:Description). --Slomox (talk) 11:32, 25 October 2011 (UTC)
Replacing '''{{#language:{{{1}}}}}{{{5|}}}:''' with '''{{#if: {{{5|}}} | {{{5|}}} | {{#language:{{{1}}}}} }}:''' should actually be enough, to display the name of languages unsupported by {{#language: }} without the need to display the language code. Or do I miss any disadvantages? Parameter {{{5}}} doesn't have any other purposes than displaying the name of the language if it's unsupported, or does it? --Slomox (talk) 11:40, 25 October 2011 (UTC)
Actually, it was added for a completely different purpose: See the relevant edit. --Mormegil (talk) 11:53, 26 October 2011 (UTC)
Oooh. I see. Then that's no solution, I guess. --Slomox (talk) 12:05, 26 October 2011 (UTC)

Fetching description in a given language[edit]

At the moment, the HTML code generated is like (for File:Anhinga anhinga (juveniles).jpg):

<div class="description en" lang="en" style="direction:ltr;" xml:lang="en"><span class="description"><span class="language en" title=""><b>English:</b></span> Juvenile Anhingas at Caño Negro, Costa Rica. Image taken from a small boat.</span></div>
<div class="description fr" lang="fr" style="direction:ltr;" xml:lang="fr"><span class="language fr" title="Français"><b>Français :</b></span> Jeunes <a href="//fr.wikipedia.org/wiki/Anhinga_d%27Am%C3%A9rique" class="extiw" title="fr:Anhinga d'Amérique">Anhingas d'Amérique</a> photographiés à Caño Negro, dans le Costa Rica, depuis une petite embarcation.</div>

This makes it hard to machine-fetch the actual description in a given language. Say I would like to retrieve the French description, I end up with the « French:» I do not really care about. What about something like:

<div class="description_wrapper en" lang="en" style="direction:ltr;" xml:lang="en">
   <span class="language en" title=""><b>English:</b></span>
   <div class="description en">Juvenile Anhingas at Caño Negro, Costa Rica. Image taken from a small boat.</div>
<div class="description_wrapper fr" lang="fr" style="direction:ltr;" xml:lang="fr">
   <span class="language fr" title="Français"><b>Français :</b></span>
   <div class="description fr">Jeunes <a href="//fr.wikipedia.org/wiki/Anhinga_d%27Am%C3%A9rique" class="extiw" title="fr:Anhinga d'Amérique">Anhingas d'Amérique</a> photographiés à Caño Negro, dans le Costa Rica, depuis une petite embarcation.</div>

Thoughts? Jean-Fred (talk) 10:13, 16 April 2012 (UTC)

Ping? Jean-Fred (talk) 16:35, 17 October 2012 (UTC)
What are you parsing it with ? Would not it be logical to prune span elements of class="language *" from the list of your description ? Esby (talk) 11:02, 18 October 2012 (UTC)
I use Xpath. Pruning the span is of course doable, but IMO an unnecessary hassle, given we can appropriately wrap what is needed. Jean-Fred (talk) 14:57, 18 October 2012 (UTC)

Symbol support vote.svg 


making it easier to get the contents but please don't forget about MediaWiki:Gadget-LanguageSelect.js before making any breaking changes. Thanks. -- Rillke(q?) 23:19, 11 November 2012 (UTC)

Inconsistent HTML tags[edit]

Oddly, a file like File:Anhinga anhinga (juveniles).jpg generates the following:

<div class="description en" lang="en" style="direction:ltr;" xml:lang="en">
    <span class="description">
        <span class="language en" title=""><b>English:</b></span>
        Juvenile Anhingas at Caño Negro, Costa Rica. Image taken from a small boat.
<div class="description fr" lang="fr" style="direction:ltr;" xml:lang="fr">
    <span class="language fr" title="Français"><b>Français :</b></span>
    Jeunes <a href="//fr.wikipedia.org/wiki/Anhinga_d%27Am%C3%A9rique" class="extiw" title="fr:Anhinga d'Amérique">Anhingas d'Amérique</a> photographiés à Caño Negro, dans le Costa Rica, depuis une petite embarcation.

As you can see, there is a <span class="description"> for the first description which is not replicated after. Thoughts ? Jean-Fred (talk) 10:13, 16 April 2012 (UTC)

The <span class="description"> comes from {{Information}} which is poorly designed because a <span> should not wrap a <div>. HTML Tidy is running over each page before it is send to the client to messes everything up. (It inserts the <span class="description"> at the first possible location resulting in this strange behaviour. -- Rillke(q?) 23:36, 11 November 2012 (UTC)

Pictogram voting keep.svg Fixed in {{Information}} and related templates. -- Rillke(q?) 14:54, 26 June 2013 (UTC)
Checkmark This section is resolved and can be archived. If you disagree, replace this template with your comment. Rillke(q?) 14:54, 26 June 2013 (UTC)



Please reverse the edit on Sept 1, it breaks uses of this template. See Template_talk:Translation_table#Borked. --  Docu  at 11:36, 9 September 2012 (UTC)

I changed it back, but before and after I see no difference... Another admin should look at it. Romaine (talk) 23:10, 9 September 2012 (UTC)
✓  Done I'm not sure of the details, but apparently it has been solved by today. Please feel free to reopen if it's not. The problem seems to have been that the translation table is split into multiple lines, but last time I checked, the layout in Category:Kings of Clubs was ok. --whym (talk) 23:43, 8 February 2013 (UTC)

Language templates with no text displayed[edit]

We now add Category:Language templates with no text displayed maintenance category to pages that use one of the language templates, without providing any text. That is often a case when:

  1. displayed text has "=" in it and does not parse correctly
  2. Some incorrectly uses it using "{{En}} some text" syntax
  3. Someone adds empty language templates in hopes that others will add translated descriptions.

There is a clean up effort related to those, see Commons:Bots/Work_requests#Display_issues_of_language_templates. However it is still very hard to find where is the problem especially on large pages. I would like to propose to mark output of empty Language templates in red to help finding them on the page when manually cleaning. --Jarekt (talk) 12:59, 19 April 2013 (UTC)

Notification of users[edit]

What about notifying the user that there is a problem with the syntax they added and that #3 above is not desirable? Maybe something like: <span class="error">Missing language text and error in syntax</span>
I think that this should be done, but maybe better as soon as the legacy cases in Category:Language templates with no text displayed have been cleaned up. --Leyo 09:28, 21 June 2013 (UTC)

I liked this withdrawn suggestion… --Leyo 15:54, 22 July 2013 (UTC)
✓  Done I added (missing text) . (I did not withdraw the suggestion, just suggested and than rediscovered that you suggested the same thing, so I canceled my edit, until I could correct it. ) --Jarekt (talk) 17:28, 22 July 2013 (UTC)
OK, thanks. Do you (or other users) think that missing text needs to be internationalized? Or what about linking the error message text to Category:Language templates with no text displayed? --Leyo 17:48, 22 July 2013 (UTC)
Symbol strong support vote.svg  Strong support both. --Zhuyifei1999 (talk) 07:53, 24 July 2013 (UTC)
Can the line break (see example) be avoided? --Leyo 17:51, 23 July 2013 (UTC)
Could you test whether Template:Description/sandbox works? --Zhuyifei1999 (talk) 07:53, 24 July 2013 (UTC)
div => span works. --Zhuyifei1999 (talk) 08:07, 24 July 2013 (UTC)
I do not think we should change div => span. I try not to mess with tags like that since changes might break some tools or templates. Especially with templates used on 13M pages. I copied User:Zhuyifei1999 sandbox to Template:Description/sandbox1 and kept modifying Template:Description/sandbox. I managed to get rid of the line break and internationalized the message (please add more translations to Template:Description/i18n, before it is used and protected) and linked the error message text to Category:Language templates with no text displayed. Any other suggestions before we change the template? --Jarekt (talk) 13:16, 24 July 2013 (UTC)
Thank you. I added de and fr. --Leyo 14:13, 24 July 2013 (UTC)
Added zh (zh-hant necessary?) --Zhuyifei1999 (talk) 14:34, 24 July 2013 (UTC)
I cannot judge this. There is also zh-hans. --Leyo 14:50, 24 July 2013 (UTC)
{{LangSwitch}} has a lot of build in fall back options like "zh-hant" or "zh-hans" -> "zh" -> "default" -> "en", so more specific languages are optional. --Jarekt (talk) 16:07, 24 July 2013 (UTC)



correcting {{Description}} --Jarekt (talk) 16:07, 24 July 2013 (UTC)

I recommend to have semi-protected instead of fully protected. --Zhuyifei1999 (talk) 06:22, 25 July 2013 (UTC)
I changed protection of {{Description/i18n}} to semi-protected. {{Description}} has to be fully protected, but text of {{Description/i18n}} is only used on few pages, hopefully. --Jarekt (talk) 12:05, 25 July 2013 (UTC)


@Jarekt, Zhuyifei1999, Leyo: I'm going to replace the DIV with span style="display: block;". It is absolutely not to expect that this template removes all line-feeds (which is also paradox/contrary to the inline parameter). There should be no negative result (in the unlikely case, then it should be fixed there; currently on Template:Description/sandbox).

Template:Description/testcases -- User: Perhelion 14:43, 11 December 2017 (UTC)
New template has much nicer behavior in Template:Description/testcases, but it changes machine-readable markup. I wonder if any tools rely on current markup. @Tgr (WMF): you were looking at the markup. Any opinions? --Jarekt (talk) 16:15, 11 December 2017 (UTC)
Yeah, CommonsMetadata looks for div.description; please don't change it unless that's fixed. Also, a span can only contain certain kinds of HTML tags ("phrasing content") while a div is pretty much unrestricted, so this would result in invalid HTML whenever someone uses a div inside the description. Not sure how big a deal that is; browsers don't care but maybe the linter does? --Tgr (WMF) (talk) 17:20, 11 December 2017 (UTC)
(For reference, the change is [1] --Tgr (WMF) (talk) 17:22, 11 December 2017 (UTC))
It seems like span.description is already used in other places and would cause a conflict. I recommend creating a #Machine-readable standard markup for i18n templates before changing this. --Tgr (WMF) (talk) 18:56, 11 December 2017 (UTC)
Good hint, thanks, but this sounds really theoretically. What could the errors look like? 1. In practice there should be no block-elements in the language-tags. 2. The span element is the most general element, the description class seems to be used on some tags. I understand there should be some conformity (as the class.description is intended for). You mean there is no entry for this template on COM:Machine-readable data? -- User: Perhelion 22:48, 11 December 2017 (UTC)
@Tgr (WMF), Jarekt: another reason is the UploadWizard, which not converts line-feeds to BR (what is OK) but so the result is also not as expected. -- User: Perhelion 11:09, 14 December 2017 (UTC)
@Perhelion: The error will be that 1) if we don't change CommonsMetadata it won't find the description anymore (as it is looking for div.description specifically) and that will break image display in MediaViewer, the mobile apps etc; 2) if we do change CommonsMetadata to look for span.description as well, it might find other strings that are not actually the description it is looking for. I'm not sure if 2) is a real problem (as it only looks for descriptions inside #fileinfotpl_desc), but it will require some testing; definitely not something to do during/just before the holidays. --Tgr (WMF) (talk) 19:37, 20 December 2017 (UTC)

Machine-readable standard markup for i18n templates[edit]

I started a discussion about standardizing the markup generated by i18n templates so that it can be made machine-readable: Commons talk:Machine-readable data#Machine-readable markup for languages/language names; please share your opinion! --Tgr (WMF) (talk) 11:16, 11 November 2014 (UTC)