Page MenuHomePhabricator

Expiration field on Special:Block only accepts English input
Open, Needs TriagePublic

Description

Problem
The "Expiration" field on Special:Block only accepts English input.

The select box has several options, the values must be in English because that is all strtotime() supports.

This means that the label can be translated into the wiki's language, but the value is in English:
https://de.wikipedia.org/wiki/MediaWiki:Ipboptions

If a user goes to: https://de.wikipedia.org/wiki/Spezial:Sperren but their language is set to something other than de they will continue to see the labels in de

What's worse, the "Other time" option gives a text field and that text field can only accept input in English.

See T132220#4066969

Another problem is that if you are changing an existing block, the datetime that is displayed (from the database) is only in an English format. And the DateTimeInputWidget has to change it's ISO 8601 format to an English-only RFC 2822 format. See T132220#4130623

Solution
The values should be ISO 8601 Time Interval Durations, but the labels should be translatable (into any language, not just the language of the wiki). For instance, in code we should take the time intervals and transfer them into a string like $1 days which can then be translated into the user's preferred language.

The "Other" field should expose 2 more fields (instead of just 1). The first would be a number input and the second would be a drop down with units (i.e. "days", "weeks", "years", etc.) which would also be translated into the user's preferred translation.

This change would break any options specified in https://de.wikipedia.org/wiki/MediaWiki:Ipboptions we should mitigate this by creating an update script that would transfer the options into ISO 8601 Time Interval Durations (and remove the translations). We should also allow for them to specify other options like "indefinite" but this would just use a translation key rather than have the translation itself within the option.

When switching between the two fields (or changing an existing block), we'll have to round a precise date to a relative date (or display the DateTimeInput Widget as the default when changing a block)

Event Timeline

Thank you for filing, David.

Some of the data we're hoping to generate in T190328 will be informative if we want to proceed with changing how the expiration dropdown and field functions. We'll also want to confer with admins who perform a lot of blocks (maybe the list from T180071?) to make sure we won't majorly interrupt any existing workflows.

Why is it a free text field at all?

What can be written there?

I can hardly even find documentation about it. It's not explained on Special:Block itself (unless I'm missing it). It is mentioned on https://www.mediawiki.org/wiki/Help:Blocking_users , but it raises more questions than it answers.

Why isn't it some kind of a date and time control, so that people won't have to type the date manually?

What can be written there?

You can write any of the supported date and time formats, though I suspect that most people would write a relative format.
Example:
"2 days"
"Monday next week"
etc.

Why isn't it some kind of a date and time control, so that people won't have to type the date manually?

We're adding a datetime selector in T132220: Add datetime selector to Special:Block to select expiration but leaving the dropdown / "other" input for now. We could remove the drop down completely, or just remove the "other" input. Alternatively, we could provide an I18n relative input as described in this task's description.

In my experience as a volunteer, virtually 100% of all blocks I've made have been for time periods rather than absolute expiry times. The most common (outside of "indefinite") is probably 31 hours, since that is effectively two days. I imagine other admins do similar with that field for longer blocks than 31h but which are likewise oddly-timed.

It would generally be pretty weird if I had to pick an absolute time in the future for the user to become unblocked rather than eye-balling it with some duration instead.

Also, fun fact: Until not that long ago, you could input a duration in virtually any way you wanted, and if the system understood it, it'd block accordingly. (A "microfortnight" worked, a "chicken" did not.)

And yes, 2008-Fox was pretty immature.

What can be written there?

You can write any of the supported date and time formats, though I suspect that most people would write a relative format.

Well... that's exactly what I'm talking about. Are sysops actually familiar with the PHP date formats? Is it documented anywhere in the MediaWiki help pages that these are the formats to use?

And are they necessary at all? It may be worth analyzing how often is this field used (if it wasn't analyzed already), and consider removing it if it's not used often.

We're adding a datetime selector in T132220: Add datetime selector to Special:Block to select expiration but leaving the dropdown / "other" input for now. We could remove the drop down completely, or just remove the "other" input. Alternatively, we could provide an I18n relative input as described in this task's description.

It would be conceptually cool to have a way to write custom time strings in any language, but I don't think that it would scale easily. It's probably enough to simply provide a convenient calendar control.

On a more general note, even though I've had the sysop permissions for a long time, I don't often use them for blocking. Asking people who do block often makes a lot of sense. Of course, it would be great to hear from people from a lot of different projects and languages, including English ;)

On a more general note, even though I've had the sysop permissions for a long time, I don't often use them for blocking. Asking people who do block often makes a lot of sense. Of course, it would be great to hear from people from a lot of different projects and languages, including English ;)

A great point. Not personally sure if customs vary by project.

On a more general note, even though I've had the sysop permissions for a long time, I don't often use them for blocking. Asking people who do block often makes a lot of sense. Of course, it would be great to hear from people from a lot of different projects and languages, including English ;)

A great point. Not personally sure if customs vary by project.

Oh, they probably do. The biggest projects have more people to block. The least active projects have mostly weird vandals from other projects making their last attempts to do damage after being kicked out of their home wikis (I'd guess that a lot of global blocks happen there, although I didn't count). And in the middle there are the medium-activity projects, which have different stories and are very interesting to listen to.

Also, different wikis had their blocking policies and help pages written by different people in different times, so it's pretty certain that they developed different practices and styles.

dbarratt updated the task description. (Show Details)