Template talk:Potd description

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

DO NOT, UNDER ANY CIRCUMSTANCES, ADD SO MUCH AS A SINGLE BYTE TO THIS TEMPLATE: This is used so many times that it gets multiplied to a huge number.

Documentationview · edit · history · purge ]
This documentation is transcluded from Template:Potd description/doc.

Support template for Commons:POTD. This template is used to tag daily localized potd templates.

{{potd description|<description>|<language>|<year>|<month>|<day>}}

For example: {{potd description|some description|en|2024|11|13}} Note: Day/Month/Year must be given in the format specified (eg March = 03), or automatic categorisation may fail. A language code or date not matching the template name may also break the template (so eg Template:Potd/2010-04-24 (ca) must use language code ca and date parameters 2010|04|24). Note: localization is handled via a {{LangSwitch}} in the helper template {{Pdh}}.

The template automatically sets the following categories:

Usage

{{Potd description |1= |2= |3= |4= |5= }}

Template parameters

ParameterDescriptionDefaultStatus
1Description of POTDemptyrequired
2Language code (xx) (see Commons:Language templates/table)emptyrequired
3Year (YYYY)emptyrequired
4Month (MM)emptyrequired
5Day (DD)emptyrequired

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: all users

See also

Localization

This template is not intended to be localized.

The main code for this template is found in Template:Potd description helper. This template is used hundreds of times on some pages, and, thanks to the way code is evaluated, giving it a shorter statement to skip past speeds things up a lot.

Top

The current template do following categorization of the templates:

  • Category:Potd templates (language), where language can be: en, fr, de, mk, ....
  • Category:Potd templates year-month, where year can be:2007, 2008, 2009, ... and month is in range (1-12)

But the Category:Potd templates (language) has a many items inside and it will be good if we introduce subcategories like this

  • Category:Potd templates year-month (language), where year can be:2007, 2008, 2009, ... and month is in range (1-12), and language can be: en, fr, de, mk, ....

I made some fix of this template, you can see it here: User:Brest/Test, and example of used template you can see here {{Potd/2009-10-03 (mk)}}

For me, this is proper implementation, if you (the admin, and protector of this template) think that this sugestion is proper for implementation, please implement it.--Brest (talk) 07:24, 30 September 2009 (UTC)[reply]

Please no. This way the number of categories would explode and we would end up with lots of nearly empty categories. See Category:Potd templates by language and Category:Potd templates by date. All categories have less than 2000 items. That's less than 10 pages. I will change {{Potd category header}} so that finding the right item will be easier. Multichill (talk) 07:55, 30 September 2009 (UTC)[reply]
Ok, changed the header template. Could use an layout improvement. Multichill (talk) 08:24, 30 September 2009 (UTC)[reply]
I didn't think anyone actually used these categories for navigation. They're more or less tracking categories, mainly existing so we can have every template categorized. Rocket000 (talk) 08:54, 30 September 2009 (UTC)[reply]
Changing {{Potd category header}} didn't take a lot of effort and makes navigation a lot easier. I hope this will make brest happy :-) Multichill (talk) 09:01, 30 September 2009 (UTC)[reply]
Stil I can't see all potd in same category for same language in same month, that was what I like to see, but if it is stressfull for the parser, don't change.--Brest (talk) 19:37, 30 September 2009 (UTC)[reply]

Possible translation problems

I'm afraid we're going to hit parser limits. We're already at 75% at some pages. If pages start breaking down I'll just remove the translations and switch back to only English. Multichill (talk) 15:04, 30 September 2009 (UTC)[reply]

This is really a pity, but if the pages are no longer loading or only very slowly, then of course we have to remove it. An English text is still better than no text. --The Evil IP address (talk) 19:58, 30 September 2009 (UTC)[reply]

So, as far as I understood, you won't apply any new translations? Wizardist (talk) 00:12, 10 January 2010 (UTC)[reply]

No, feel free to add a translation. In case this localization gives us problems, it might be possible that we have to remove it, but we then have a translation in the revision history that we can restore everytime. --The Evil IP address (talk) 09:25, 10 January 2010 (UTC)[reply]

more customization

The themplate all the times say (in english):

This is the (Language) translation of the Picture of the day description page from (in english) ....
....
then follow specific language translation, for example macedonian translation
.... 
Descriptions in other languages (in english):

But it will be better if the template message is also translated:

This is the (Language) translation of the Picture of the day description page from (in macedonian) ....
....
then follow specific language translation, for example in macedonian translation
.... 
Descriptions in other languages (in macedonian):

i.e.

Ова е македонски превод на страницата за слика на денот
....
then follow specific language translation, for example in macedonian translation
.... 
Опис на други јазици:

--Brest (talk) 19:52, 30 September 2009 (UTC)[reply]

eo, fr and mk translations

Please add french, esperanto and macedonian translations.

{{LangSwitch
|eo=Ĉi tio estas la traduko en la {{language/eo|{{{2}}}}}n de la priskriba paĝo por la [[COM:POTD|Bildo de la Tago]] {{ISOdate|{{{3}}}-{{padleft:{{{4}}}|2|0}}-{{padleft:{{{5}}}|2|0}}|eo}}.
|fr=Ceci est la traduction en {{language/fr|{{{2}}}}} de la page de description de l'[[COM:POTD|Image du Jour]] pour le {{ISOdate|{{{3}}}-{{padleft:{{{4}}}|2|0}}-{{padleft:{{{5}}}|2|0}}|fr}}.
|mk=Ова е превод на {{language/mk|{{{2}}}}} описната страницата за [[COM:POTD|Слика на денот]] на {{ISOdate|{{{3}}}-{{padleft:{{{4}}}|2|0}}-{{padleft:{{{5}}}|2|0}}|mk}}.
}}

 <div style="border:1px solid grey; padding:.2em 1em; margin-right:330px; direction: {{#dir:{{{2|}}}}}">{{#if:{{{1|}}}
 |{{lang|{{{2|}}}|{{{1}}}}}
 |<span class="error">{{LangSwitch
  |de=Die Beschreibung fehlt! Markiere die Seite mit {{speedydelete}}, falls sie  fehlerhaft erstellt wurde.
  |en=Description missing! Tag this page with {{speedydelete}} if it was created by mistake.
  |eo=Mankanta priskribo! Marku ĉi tiun paĝon per {{speedydelete}} se ĝi estis erare kreita. 
  |fr=Description absente! Marquez cette page avec {{speedydelete}} si elle a été créée par erreur. 
  |mk=Недостасува опис! Означи ја оваа страница со {{speedydelete}} ако е создадена по грешка.
 }}</span>[[Category:Potd templates missing descriptions]]
}}</div>

{{LangSwitch
|en=Descriptions in other languages:
|eo=Priskribo en aliaj lingvoj:
|fr=Légende dans d'autres langues:
|mk=Описи на други јазици:
}}
✓ Done (next time, try using {{Editprotected}}, as this categorizes the talk page into a category that's frequently patrolled by admins and the request then doesn't take that long.) --The Evil IP address (talk) 09:45, 10 January 2010 (UTC)[reply]

mk, macedonian translation, as should be

|mk=Ова е превод на {{language/mk|{{{2}}}}} јазик на описната страницата за [[Commons:Слика на денот|Слика на денот]] на {{ISOdate|{{{3}}}-{{padleft:{{{4}}}|2|0}}-{{padleft:{{{5}}}|2|0}}|mk}}. --Brest (talk) 19:59, 22 January 2010 (UTC)[reply]

✓ Done. --The Evil IP address (talk) 21:45, 22 January 2010 (UTC)[reply]
Great, thank you, but please reword it as bellow, my mistake. :) --Brest (talk) 13:42, 23 January 2010 (UTC)[reply]

|mk=Ова е превод на {{language/mk|{{{2}}}}} јазик на описната страница за [[Commons:Слика на денот|Слика на денот]] на {{ISOdate|{{{3}}}-{{padleft:{{{4}}}|2|0}}-{{padleft:{{{5}}}|2|0}}|mk}}.

✓ Done --Mormegil (talk) 14:09, 23 January 2010 (UTC)[reply]

ru translation

{{Editprotected}} Please add russian translation:

first:

|ru=Это страница с переводом описания [[COM:POTD|«Изображения дня»]] от {{ISOdate|{{{3}}}-{{padleft:{{{4}}}|2|0}}-{{padleft:{{{5}}}|2|0}}|ru}} на следующий язык: {{language/ru|{{{2}}}}}.

two:

|ru=Некорректное описание! Если эта страница была создана по ошибке, пометьте её шаблоном {{speedydelete}}.

three:

|ru=Описания на других языках:

--Kaganer (talk) 14:05, 14 April 2010 (UTC)[reply]

 Comment: You might first want to create {{Language/ru}}, translated from {{Language/en}}. {{#language:}} will give the language name in the specified language, i.e. English, Deutsch or Francais, but not the Russian one. --The Evil IP address (talk) 13:57, 15 April 2010 (UTC)[reply]
{{Language/ru}} created. --Kaganer (talk) 14:45, 19 April 2010 (UTC)[reply]
Thanks, I did it now. --The Evil IP address (talk) 16:50, 19 April 2010 (UTC)[reply]

Efficiency tweaks

This template can be used hundreds of times on the month pages such as Commons:Potd: 60 languages, * 30 days = 1800 usages. It'll normally be nearer, oh, 450, but that's still enough that effeciency matters

Luckily, there's an easy way around it: everything in this template will be loaded for every single transclusion, but anything on the wrong side of an #ifeq won't get evaluated. So if we move all the prettying-up code to its own template, and just have this one decide whether to call it or not, we can save a lot of loading time.

As such, I moved all that code to Template:Potd description helper, and the usage description to Template:Potd description usage. With a template used as many times as this one is, it only takes some small efficiency savings to make things load a LOT faster.

That said, it uses an #ifeq. There's a hard limit on the number of #ifeqs permitted per page, and if it's too low, and we're risking killing PotD with this, it may be necessary to kill this template. I suspect we're safe enough for now, though: I've managed to do a lot of efficiency work on PotD of late, and literally 2,790 #ifeqs are no longer used in setting up PotD. Long story, suffice to say that some code that made sense when we had only a few languages did not deal well with the number of languages increasing to 60. Luckily, some much more efficient code could serve the same purpose. Adam Cuerden (talk) 22:35, 3 May 2010 (UTC)[reply]

I also agree that using this template is extremely inefficient.
  • It's only role is to display a documentation notice, when the template page itself is viewed, otherwise, it will just display the text. For this reason, the descriptions should not even need to use this template, and instead the "helper" subtemplate (which adds another recursion and uses more post-include memory by more than doubling the size), should only be used to create the box below the decription in the template page view.
  • The parameter naming is completely inefficient, as it almost always requires numbering the parameters explicitly (because the description text will frequently contain markup (including an equal sign for example in HTML attributes), the parameters should have been in that order: year|month|day|lang|text=description, where only the description had to be named explicitly.
If we put the description text out of this template, there's no need to perform any test, the localized description templates just have to contain the description, and almost nothing else (if you want to include the languages box, call a documentation template after the description, by putting it within a noinclude section (this will save lots of post-include size, notably now that POTD and MOTD have been merged on the same page.
So in summary, this template should really be deprecated (this becomes urgent now, as we are reaching the maximum post-include size since MOTD and POTD projects have been merged on the same page), and existing uses should be converted to use a noinclude section for the helper, the helper subtemplate not needing the description text itself, but just the date and the language code.
Note that using a #ifeq has a virtual cost of 0. This is not at all the problem we can see now (explosion of the post-include size due to excessive recursions).
In fact we don't even need it if localized the image/media description templates are just written like this:
This is a ''sample'' description of an image or media,
possibly containing arbitrary markup.<noinclude>
{{Pdh|<nowiki/>|2010|12|31|en}}
</noinclude>
Note that parameters don't need now to be numbered now, this is shorter and more readable:
  • Just the date fields and the language code.
  • But you really want to have explicit parameter names, to make it more obvious for readers/translators, this could be as well:
This is a ''sample'' description of an image or media,
possibly containing arbitrary markup.<noinclude>
{{Pdh|<nowiki/>|yyyy=2010|mm=12|dd=31|lang=en}}
</noinclude>
  • For compatibility (of parameters numbering) a dummy (nowiki/) is passed in parameter 1 to suppress the error message when the description is not there. In reality, there should not even exist such a parameter.
Note also that such syntax can easily be generated automatically from existing description templates, according to their names, by just appending the noinclude section: look at the names of these templates. Writing the code this way will then generate 0 usages on the COM:POTD page itself, and 0 tests.
verdy_p (talk) 14:54, 26 May 2010 (UTC)[reply]
I've not changed the existing code of the Potd description helper template (so the parameter numbering is still needed as there's still a need to pas an arbitrary text in parameter 1, but to see how this could look like : Template:Potd/2010-05-29 (fr)
Is there still the need to pass the text, and to display it twice (once below the image in the thumbnail, another time in a box on the left) ???
Those that created this template never thought about it for more than one second. Don't use this template the way it is now. Really don't ! We don't even need it, when we can list templates starting by a common substring (everything but the language code) very easily and automatically without even performing any test. verdy_p (talk) 15:15, 26 May 2010 (UTC)[reply]
Then how are new translations to be added? Adam Cuerden (talk) 06:59, 27 May 2010 (UTC)[reply]
Did you look at my sample code above ? This completely solves the heavy recursion problem (that doubles the memory need)
Note that calling the template from the noinclude section will also make it behave exactly like a default (generated) documentation page for the desciptions template, so that it can perfectly display all other translations of the same description. BUT ONLY when the template page is viewed, NOT when it is used from any other page.
An how many renames of the description helper template will you do ? verdy_p (talk) 06:10, 28 May 2010 (UTC)[reply]
It actually saves a surprising number of bytes on the main PotD page to have a redirect with a very short name. But, I apologise, I was somehow thinking this was Template:Potd/Day or the like. Honestly, if I could do something about this template, I would. But it's used so many hundreds of times already, that it's hard to depreciate. Adam Cuerden (talk) 23:21, 28 May 2010 (UTC)[reply]

Broken

Are there any works on the template? Something goes wrong. All tables, category links, etc. trapped into the thumb description under the image. Wizardist (talk) 23:01, 27 May 2010 (UTC)[reply]

Hmm? That's a little odd. I actually reverted the backend of this to the old format. I'll have a look. Adam Cuerden (talk) 23:05, 27 May 2010 (UTC)[reply]

TemplateData

Can some sysop add the TemplateData for this template so that can be added using the "Add template" function (the one with the puzzle icon)?--Mannivu · 11:37, 2 January 2020 (UTC)[reply]

See the first line on this talk page (about not expanding it). That's why it doesn't have documentation template. Multichill (talk) 18:36, 3 January 2020 (UTC)[reply]
@Multichill: And why section edit links are made unavailable on this talk page. I don’t see why replacing the <noinclude> section of the template would cause issues. Yes, it puts significant one-time load on the servers (as all pages should be reparsed), but 100k pages are not that much; however, long-run performance even improves, as the raw wikitext’s length can be reduced by up to 36 bytes, while the expanded size of the documentation template has effect (as far as I know) only on this one page. —Tacsipacsi (talk) 21:12, 3 January 2020 (UTC)[reply]
@Adam Cuerden: what do you tink? Will it be possible after almost 10 years to finally add {{Documentation}} to this template? :-) Multichill (talk) 21:54, 3 January 2020 (UTC)[reply]
But strictly as {{doc}} to use as few bytes as possible. ;-) By the way, this is the first template I see on Commons to have instruction on using as few bytes as possible, while far from being the most widespread. Often-used Commons templates have at least some millions, but rather tens of millions of transclusions, not less than 100k… --Tacsipacsi (talk) 22:23, 3 January 2020 (UTC)[reply]
@Tacsipacsi and Multichill: It's been ten years, but the problem, as I remember it, is that the POTD preparation pages ran very close to the byte limits a lot of the time, as well as transclusion. They probably have upped the limits since, but this template had to be cut down a lot so that the monthly prep pages wouldn't break at the time. The POTD prep was barely functional, and was breaking, because this template is used (or was: we seem to have hidden alternate language translation now, which has its own downsides) for every single translation on the page, which meant one POTD preparation page, with 31 entries, and, say, 20 languages for each entry, could be calling it 620 or more times. It's not that it's used on a lot of pages, it's that it's used literally hundreds of times on one page, which is unique to this template. Sorry I'm so late! Adam Cuerden (talk) 14:31, 20 November 2020 (UTC)[reply]
@Adam Cuerden: As far as I know, (currently) to sizes count: the pre-expand size, which includes the <noinclude> section’s size but counts only wikitext that’s on that very page (so {{doc}} is seven bytes, not however long the documentation subpage is), and the post-expand size, which doesn’t include the <noinclude> section. So neither of these numbers include the documentation’s size and thus I think it’s okay to have a documentation subpage. By the way, if there’s any single page that could potentially run out of limits with the edit, anyone who has the right to edit this template can use the Preview page with this template after doing the change but before saving to check how the page would look like. —Tacsipacsi (talk) 21:22, 23 November 2020 (UTC)[reply]