Page MenuHomePhabricator

Autoblocker message is localized in blocking user’s language
Closed, ResolvedPublic

Description

When a user blocks another user and the last IP they used, DatabaseBlock::doAutoblock() inserts a reason localized using the autoblocker interface message:

$autoblock->setReason(
	wfMessage(
		'autoblocker',
		(string)$this->getTarget(),
		$this->getReasonComment()->text
	)->plain()
);

It doesn’t set any particular language for this message, so it will use whatever the language of the blocking user is. This may not be the same as the wiki’s content language, let alone the languages of other people affected by this IP block, which can be confusing:

Screenshot_2019-11-18 View source for Help Contents - Wikidata.png (294×580 px, 40 KB)

Screenshot_2019-11-18 Mostrar código-fonte de Help Contents - Wikidata(1).png (316×584 px, 42 KB)

It would be nice to actually store the message as the reason, so that it can be localized in the viewing user’s language when necessary; however, that would probably take a lot of effort. But at least it should be possible to make DatabaseBlock::doAutoblock() insert this message in the wiki’s content language, rather than the current user language.

Event Timeline

Change 551589 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/core@master] Use content language for autoblocker message

https://gerrit.wikimedia.org/r/551589

Change 551589 merged by jenkins-bot:
[mediawiki/core@master] Use content language for autoblocker message

https://gerrit.wikimedia.org/r/551589

Lucas_Werkmeister_WMDE claimed this task.

It uses the content language now, which I guess is good enough to close this task (though storing a message object, and always showing it localized, would be even nicer).

Screenshot_2020-04-27 Erro de permissão - Wikidata.png (337×579 px, 60 KB)