Template talk:Deadline
Add topicCustom messages
[edit]Messages like the one removed in [1] may be hard to translate and don't seem to go to the translation memory: can the week and year just be part of the template and be translated as part of it? --Nemo 14:46, 23 May 2015 (UTC)
Converting template to use zoneStamp
[edit]Currently the template uses timeanddate.com, an external site. https://zonestamp.toolforge.org/ seems to have very similar features, with no adverts, tracking code, etc, and hosted on Wikimedia servers. Does anyone have thoughts on converting the template to use zoneStamp? EpicPupper (talk) 23:51, 17 January 2022 (UTC)
- @EpicPupper Very late reply (coincidentally a year and a day late!).
- I would like this option, too. I investigated it in the past years, and got as far as understanding the problem (but not as far as watchlisting this page, it seems! But a colleague just asked me about the issue, hence I'm came re-researching).
- AFAICT, it's not possible to generate these links automatically, because Zonestamp is a very-purposefully simple tool. (upstream github)
- If that is true, I suppose the choice comes down to:
- continuing to use timeanddate.com
- using plaintext UTC with no link at all
- manually creating a new Zonestamp every week.
- I lean hesitantly towards (2), as I'm not even sure if anyone uses that link. I'll think about it, and ask around for more thoughts...
- Although... Now that I stare at it again, I've realized that the URL string is actually Unix time. Huh. Maybe it is possible to auto-generate it?! (If you know how, please do! Otherwise I'll ask around for that, instead.) Quiddity (WMF) (talk) 01:52, 18 January 2023 (UTC)
- @Quiddity (WMF) thanks for the reply! I do believe the URL string is Unix time, yes :) I've drafted up a version of the template that uses ZoneStamp and converts to Unix time here (see testcases). One notable thing with zoneStamp is that it doesn't support custom messages; I don't think adding the
msg
parameter somewhere in the template is appropiate either (saying something like "This document (Publication of Wikimedia Tech News)" doesn't have a natural flow to it, I think). I hope this is an okay tradeoff! Some other notes with this version:- any errors in the time format display at the start of the message, not awkwardly in the middle
- when no time is provided, simply no link is rendered.
- Please let me know your thoughts! Cheers, EpicPupper (talk) 05:05, 18 January 2023 (UTC)
- Another note: this version doesn't support seconds in the time (I'm sure it could with some more template-wrangling), but I doubt that anyone would want that much precision :) EpicPupper (talk) 05:07, 18 January 2023 (UTC)
- @EpicPupper That looks great to me! I agree we definitely don't need the extra message at the destination, nor second-precision. Thank you so much for the fixes, and the explanation. If it's ready to be replaced, please go for it!
- As far as I can tell, Tech News is the only place that uses the template, so we're fine to just boldly update it.
- You've almost certainly already seen, but the 1st parameter in the template is automatically defined via line 3 of Tech/News/init (which we use via the "create next" link, within the draft Tech News edition's page, every Friday). As long as that still works, I think this is solved?
- Let me know if there are still unresolved questions or complexities, otherwise, thank you again! Quiddity (WMF) (talk) 21:13, 18 January 2023 (UTC)
- @Quiddity (WMF) fantastic, edited! Have a great day. EpicPupper (talk) 23:36, 18 January 2023 (UTC)
- Another note: this version doesn't support seconds in the time (I'm sure it could with some more template-wrangling), but I doubt that anyone would want that much precision :) EpicPupper (talk) 05:07, 18 January 2023 (UTC)
- @Quiddity (WMF) thanks for the reply! I do believe the URL string is Unix time, yes :) I've drafted up a version of the template that uses ZoneStamp and converts to Unix time here (see testcases). One notable thing with zoneStamp is that it doesn't support custom messages; I don't think adding the
Trying to fix the "Invalid time" error
[edit]Hi. Can anyone please help to fix that "Invalid time" error such as in Tech/News/2023/18/fa? What i can see in this template, is that the error is coming from the first #iferror function and can be fixed with converting the {{{1}}} argument to a valid value and pass it to the #time function. My problem in this path is that I don't know what is the value of {{{1}}} when passed to the template on Tech News pages. The source code of the news page is also not available to me. Regards. Jeeputer (talk) 14:48, 29 April 2023 (UTC)
- @EpicPupper: Hello. I saw your previous messages here after I posted this thread. Can you help me with fixing that error? At least in finding the value passed to the first parameter. Thanks. Jeeputer (talk) 14:58, 29 April 2023 (UTC)
- @Jeeputer You can find the source code of the news page at Tech/News/2023/19 - e.g.
{{Deadline|20230508T14}}
, which is generated each week via creating a new page using Tech/News/init. However, beyond that level of detail I get lost in the parser functions. :-( - Does that help you at all?
- I think I've seen this error before, but I don't usually check the translations until after I've removed that template, hence I'd forgotten about it. >.<
- Now that I look further, I see that the error exists for a few languages that were translated this week... ar, fa, hi, bn, kn. I will Not remove the Deadline template this week, in case that helps diagnosing the issue.
- @Frostly: Perhaps you can help with this complexity, if those pointers don't help Jeeputer to fix it?
- Thanks, both! Quiddity (WMF) (talk) 20:10, 1 May 2023 (UTC)
- @Quiddity (WMF): Thank you. in Tech/News/init I can see a
{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}
to extract the year from the title of the page (فناوری/اخبار/۲۰۲۳/۱۸) and a similar call for the week. These functions will extract ۲۰۲۳ as year and ۱۸ as the week, then pass it to a #time: function:{{subst:#time:Ymd|۲۰۲۳-W۱۸}}
. But as they are not raw English integers, time function returns Error: Invalid time.. - I thought that passing those
#titleparts
calls toformatnum
(i.e. {{subst:formatnum:{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}}}) can perish the error, but theformatnum
function does not format Persian (or any other languages) numbers here on meta. so{{formatnum:۲۰۲۳}}
still returns ۲۰۲۳ (see here). - The only way we can fix this is by passing raw English integers to that
#time
parser function (i.e. 2023-W19 for this week, instead of ۲۰۲۳-W۱۹ for Persian translation), but extracting it from the page's name (which contains non-English numbers) is not the most reliable way to do that. - We need either a function/template/module to convert all numbers to raw English integers or to extract the year and the week from somewhere other than the page's title.
- We have w:fa:Module:Numeral converter (which also implements w:fa:Template:Formatnumber; something like the formatnum parser function) on fa-wikipedia but I'm not a Lua expert and not sure if I can modify that module to do the job here. Jeeputer (talk) 05:28, 2 May 2023 (UTC)
- The page name of Tech/News/2023/18/fa is
Tech/News/2023/18/fa
, not فناوری/اخبار/۲۰۲۳/۱۸, that’s just the displayed title. - But it doesn’t actually matter: since the code on /init uses
subst
, the parser function and magic word have been substituted at the moment Tech/News/2023/18 was created, and that substituted text was copied over to the translated pages. As you can see if you open the source code of the page, it correctly contains{{Deadline|20230501T14}}
. - Of course
{{formatnum:۲۰۲۳}}
won’t return2023
: it formats a number, i.e. turns an unformatted number (2023
) into a formatted one (2,023
,۲۰۲۳
etc.).
- The page name of Tech/News/2023/18/fa is
- Tacsipacsi (talk) 19:12, 4 May 2023 (UTC)
- @Quiddity (WMF): I think Special:Diff/24983477 will fix this, but I don't know how to apply it to other languages. should I edit other versions one by one? Or is there a way to apply at once?
- @Tacsipacsi: Thank you, it helped me find a better solution. hope it works.
- Jeeputer (talk) 06:01, 5 May 2023 (UTC)
- @Jeeputer: No, you neither should nor could edit all translations. Translations cannot be edited directly; they are updated by the software when a translation administrator (like me or Quiddity) presses a button (or when someone creates/edits a translation using the translation interface). I pressed that button now, and it looks like it’s indeed fixed. —Tacsipacsi (talk) 16:47, 5 May 2023 (UTC)
- @Tacsipacsi & Quiddity (WMF): Thank you. That error was tickling my nerves for months. :D Jeeputer (talk) 06:47, 6 May 2023 (UTC)
- Thanks all! Frostly (talk) 00:09, 29 May 2023 (UTC)
- @Jeeputer: No, you neither should nor could edit all translations. Translations cannot be edited directly; they are updated by the software when a translation administrator (like me or Quiddity) presses a button (or when someone creates/edits a translation using the translation interface). I pressed that button now, and it looks like it’s indeed fixed. —Tacsipacsi (talk) 16:47, 5 May 2023 (UTC)
- @Quiddity (WMF): Thank you. in Tech/News/init I can see a
- @Jeeputer You can find the source code of the news page at Tech/News/2023/19 - e.g.