Make edit summary of blocked domain changes use i18n

It shouldn't be all in English.

Bug: T337431
Change-Id: I57c6b08b652e83baaef41ab0b74af7a4668698a2
This commit is contained in:
Amir Sarabadani 2023-06-08 21:47:37 +02:00
parent 0acfe05251
commit 9ca20e7749
3 changed files with 11 additions and 2 deletions

View file

@ -585,6 +585,8 @@
"abusefilter-blocked-domains-attempted": "The text you wanted to publish was blocked by our filter. The following domain is blocked from being added: $1",
"abusefilter-blocked-domains-json-error": "JSON should be an array",
"abusefilter-blocked-domains-invalid-entry": "Entry $1 in JSON is invalid - it should be an object with 'domain' and 'notes' fields only, both being strings",
"abusefilter-blocked-domains-domain-added-comment": "Add blocked external domain $1 with notes: $2",
"abusefilter-blocked-domains-domain-removed-comment": "Remove blocked external domain $1 with notes: $2",
"log-description-abusefilterprivatedetails": "This log shows a list of times when a user accessed the private details of an abuse log.",
"abusefilter-noreason": "Warning: To see the private details of this log, you must provide a reason.",
"abusefilter-log-ip-not-available": "Not Available",

View file

@ -627,6 +627,8 @@
"abusefilter-blocked-domains-attempted": "The error message when adding a blocked domain has been attempted.",
"abusefilter-blocked-domains-json-error": "The error message when editing the JSON page to no longer be an array",
"abusefilter-blocked-domains-invalid-entry": "The error message when adding an invalid entry to the JSON array. Parameters:\n* $1 - the serial number of the entry which is invalid.",
"abusefilter-blocked-domains-domain-added-comment": "Edit summary when a user adds a blocked domain. Parameters\n* $1 - the domain that is blocked \n* $2 - notes and reasoning of the block.",
"abusefilter-blocked-domains-domain-removed-comment": "Edit summary when a user removes a domain from the blocked list. Parameters\n* $1 - the domain that is now removed \n* $2 - notes and reasoning of the removal.",
"log-description-abusefilterprivatedetails": "The description of the abuse filter private details access log.",
"abusefilter-noreason": "Warning message shown when no reasons is given to access the private details of an abuse log.",
"abusefilter-log-ip-not-available": "Text shown when IP address is not available.\n{{Identical|Not available}}",

View file

@ -33,6 +33,7 @@ use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Revision\SlotRecord;
use MediaWiki\User\UserFactory;
use MediaWiki\Utils\UrlUtils;
use Message;
use RecentChange;
use StatusValue;
use TitleValue;
@ -209,7 +210,9 @@ class BlockedDomainStorage implements IDBAccessObject {
return $content;
}
$content[] = [ 'domain' => $domain, 'notes' => $notes ];
$comment = 'Add blocked external domain ' . $domain . ' with notes: ' . $notes;
$comment = Message::newFromSpecifier( 'abusefilter-blocked-domains-domain-added-comment' )
->params( $domain, $notes )
->plain();
return $this->saveContent( $content, $user, $comment );
}
@ -231,7 +234,9 @@ class BlockedDomainStorage implements IDBAccessObject {
unset( $content[$key] );
}
}
$comment = 'Remove blocked external domain ' . $domain . ' with notes: ' . $notes;
$comment = Message::newFromSpecifier( 'abusefilter-blocked-domains-domain-removed-comment' )
->params( $domain, $notes )
->plain();
return $this->saveContent( $content, $user, $comment );
}