Make Nuke tag translatable

Adds `tag-nuke` and `tag-nuke-description` messages for user in
Special:Tags and changes the canonical tag name to "nuke" instead
of "Nuke".

Bug: T379168
Change-Id: Ic8846781cdac3bf08c6733f39d0cc5988fb09f6a
This commit is contained in:
Chlod Alejandro 2024-11-09 05:26:15 +08:00
parent 10f5a9b1bc
commit a5e92ffbfd
No known key found for this signature in database
GPG key ID: A1E67C59037B0CC1
5 changed files with 19 additions and 9 deletions

View file

@ -33,5 +33,7 @@
"nuke-namespace": "Limit to namespace:",
"nuke-linkoncontribs": "mass delete",
"nuke-linkoncontribs-text": "Mass delete pages where {{GENDER:$1|this user}} is the only author",
"nuke-confirm": "You are about to delete {{PLURAL:$1|one page|$1 pages}}. Are you sure that you want to delete?"
"nuke-confirm": "You are about to delete {{PLURAL:$1|one page|$1 pages}}. Are you sure that you want to delete?",
"tag-nuke": "Nuke",
"tag-nuke-description": "Deletions performed with the Nuke extension"
}

View file

@ -46,5 +46,7 @@
"nuke-namespace": "Label shown on [[Special:Nuke]] in front of the namespace input that allows choosing a namespace to filter the search by",
"nuke-linkoncontribs": "Used as link text which is used on [[Special:Contributions]] and [[Special:DeletedContributions]].\n\nOnly added if a user has rights to nuke pages.\n\nThe link has the tooltip {{msg-mw|Nuke-linkoncontribs-text}}.\n{{Identical|Mass delete}}",
"nuke-linkoncontribs-text": "Tooltip for the link which is labeled {{msg-mw|Nuke-linkoncontribs}} Parameters:\n* $1 is the target username used for GENDER.",
"nuke-confirm": "Message when the user is trying to delete pages."
"nuke-confirm": "Message when the user is trying to delete pages.",
"tag-nuke": "Short description of the nuke tag.\n\nShown on lists of changes (history, recentchanges, etc.) for each page deleted with the Tag extension.\n\nSee also:\n* {{msg-mw|tag-nuke-description}}",
"tag-nuke-description": "Long description of the nuke tag.\n\nShown on [[Special:Tags]].\n\nSee also:\n* {{msg-mw|tag-nuke}}"
}

View file

@ -38,7 +38,7 @@ class Hooks implements ContributionsToolLinksHook {
* @param string[] &$tags
*/
public static function onRegisterTags( array &$tags ): bool {
$tags[] = 'Nuke';
$tags[] = 'nuke';
return true;
}
}

View file

@ -625,7 +625,7 @@ class SpecialNuke extends SpecialPage {
'userId' => $user->getId(),
'wikiPageId' => $title->getId(),
'suppress' => false,
'tags' => '["Nuke"]',
'tags' => '["nuke"]',
'logsubtype' => 'delete',
] );
$jobs[] = $job;

View file

@ -668,13 +668,18 @@ class SpecialNukeTest extends SpecialPageTestBase {
$this->assertStringContainsString( '(nuke-deletion-queued: Page123)', $html );
$this->assertStringContainsString( '(nuke-deletion-queued: Paging456)', $html );
$this->assertStringNotContainsString( 'Nuke', $this->getDeleteLogHtml() );
// Ensure all jobs are run
// Pre-check to confirm that the page hasn't been deleted yet
// "mw-tag-marker-nuke" is the CSS class for the "Nuke" tag's <span> on Special:Log.
$this->assertStringNotContainsString( 'mw-tag-marker-nuke', $this->getDeleteLogHtml() );
// Ensure all delete jobs are run
$this->runJobs();
$this->assertStringContainsString( 'Vandalism', $this->getDeleteLogHtml() );
$this->assertStringContainsString( 'Nuke', $this->getDeleteLogHtml() );
$this->assertStringContainsString( $fauxReason, $this->getDeleteLogHtml() );
$deleteLogHtml = $this->getDeleteLogHtml();
$this->assertStringContainsString( 'Vandalism', $deleteLogHtml );
$this->assertStringContainsString( 'mw-tag-marker-nuke', $deleteLogHtml );
$this->assertStringContainsString( $fauxReason, $deleteLogHtml );
}
public function testDeleteDropdownReason() {
@ -827,6 +832,7 @@ class SpecialNukeTest extends SpecialPageTestBase {
private function getDeleteLogHtml(): string {
$services = $this->getServiceContainer();
// TODO: Make this use qqx so tests can be checked against system message keys.
$specialLog = $services->getSpecialPageFactory()->getPage( 'Log' );
$specialLog->execute( "delete" );
return $specialLog->getOutput()->getHTML();