r91770 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91769‎ | r91770 | r91771 >
Date:23:36, 8 July 2011
Author:robin
Status:reverted (Comments)
Tags:
Comment:
Translate the block expiry date
I wonder why this hasn't been done yet...
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -2992,9 +2992,8 @@
29932993 }
29942994
29952995 /**
2996 - * Maybe translate block durations. Note that this function is somewhat misnamed: it
2997 - * deals with translating the *duration* ("1 week", "4 days", etc), not the expiry time
2998 - * (which is an absolute timestamp).
 2996+ * This translates the duration ("1 week", "4 days", etc)
 2997+ * as well as the expiry time (which is an absolute timestamp).
29992998 * @param $str String: the validated block duration in English
30002999 * @return Somehow translated block duration
30013000 * @see LanguageFi.php for example implementation
@@ -3018,8 +3017,8 @@
30193018 }
30203019 }
30213020 }
3022 - // If all else fails, return the original string.
3023 - return $str;
 3021+ // If no duration is given, but a timestamp, display that
 3022+ return $this->timeanddate( $str );
30243023 }
30253024
30263025 /**
Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -148,6 +148,7 @@
149149 * (bug 27410) The tag filter on a history page is now within a <label> element
150150 * (bug 29779) DairikiDiff/WikiDiff <ins> and <del> should undo browser default
151151 styling (strike/underline).
 152+* Translate the block expiry date
152153
153154 === API changes in 1.19 ===
154155 * BREAKING CHANGE: action=watch now requires POST and token.

Follow-up revisions

RevisionCommit summaryAuthorDate
r91786Follow-up r91770: only translate when possiblerobin12:54, 9 July 2011
r99154* (bug 31352) Fix regression causing relative block times in log display to r...brion22:20, 6 October 2011
r99155Further followup to r91770: revert the RELEASE-NOTES-1.18 entry (was in the 1...brion22:21, 6 October 2011

Comments

#Comment by Krinkle (talk | contribs)   23:44, 8 July 2011

Would this change affect the output in the IRC channels ?

The block duration noted there must be in English for bots depending on them (there are many!).

#Comment by SPQRobin (talk | contribs)   01:19, 9 July 2011

Good question. translateBlockExpiry() does translate the durations ("week, month, ...") already, although I don't really know how, so it should work.

#Comment by SPQRobin (talk | contribs)   16:41, 9 July 2011

Apparently no, because there is a check in LogPage that calls $wgContLang->translateBlockExpiry( $params[1] ); instead, for IRC channels.

#Comment by Krinkle (talk | contribs)   23:44, 8 July 2011

ie. irc.wikimedia.org/#foo.bar

#Comment by Nikerabbit (talk | contribs)   07:28, 9 July 2011

Because the value can be anything, not necessarily a timestamp?

#Comment by SPQRobin (talk | contribs)   12:56, 9 July 2011

It worked for most common formats. The only other format I could think of that didn't work was "2011-MM-DD". But I fixed the function in r91786 so it will always work.

#Comment by MaxSem (talk | contribs)   18:36, 6 October 2011

After this revision and followups:

  • Block a user for "1 second"
  • Look at that user's block log
  • You'll see current date & time as expiry date & time
#Comment by Brion VIBBER (talk | contribs)   22:13, 6 October 2011

This appears to be bug 31352.

#Comment by Brion VIBBER (talk | contribs)   22:22, 6 October 2011

Reverted in r99155.

Status & tagging log