From 9ca20e77493fa7ea36ef844f0fd1412f7de8452f Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Thu, 8 Jun 2023 21:47:37 +0200 Subject: [PATCH] Make edit summary of blocked domain changes use i18n It shouldn't be all in English. Bug: T337431 Change-Id: I57c6b08b652e83baaef41ab0b74af7a4668698a2 --- i18n/en.json | 2 ++ i18n/qqq.json | 2 ++ includes/BlockedDomainStorage.php | 9 +++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 3250af1ec..d5ba78323 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -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", diff --git a/i18n/qqq.json b/i18n/qqq.json index ea1be22c4..f381a6372 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -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}}", diff --git a/includes/BlockedDomainStorage.php b/includes/BlockedDomainStorage.php index 51e450604..e2a6f01cb 100644 --- a/includes/BlockedDomainStorage.php +++ b/includes/BlockedDomainStorage.php @@ -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 ); }