Drop unused …_suffix and …_key_with_num messages

The three messages cite_reference_link_key_with_num,
cite_reference_link_suffix, and cite_references_link_suffix are not
used for anything.

According to CodeSearch:
https://codesearch.wmcloud.org/search/?i=1&q=cite_references?_link_(key|suffix)

According to GlobalSearch:
https://global-search.toolforge.org/?q=.&regex=1&namespaces=8&title=Cite.references?.link.(key|suffix).*
For comparison:
https://global-search.toolforge.org/?q=.&regex=1&namespaces=8&title=Cite.references?.link.prefix.*

They are not meant to be localized, as noted in qqq.json. As many
messages in Cite the idea is that individual wikis can customize the
generated HTML (!) via such messages. These particular ones apparently
have been introduced just because it's technically possible, but never
been used for anything. They exist since the very first commit from
2005: https://phabricator.wikimedia.org/rECITb714bf09

Note how these messages aren't even visible anywhere, except in the
browser's address bar as part of a #… fragment.

This obviously doesn't solve T321217 but helps minimizing the
surface.

Bug: T321217
Change-Id: Icfa82155e3b02df39bb6e924bc472f6edc565d5f
This commit is contained in:
thiemowmde 2023-11-27 18:34:55 +01:00
parent 69529bdcf6
commit 202c0d3636
5 changed files with 7 additions and 20 deletions

View file

@ -38,11 +38,8 @@
"cite_error_empty_references_define": "<code>&lt;ref&gt;</code> tag with name \"$1\" defined in <code>&lt;references&gt;</code> group \"$2\" has no content.",
"cite-tracking-category-cite-error": "Pages with reference errors",
"cite-tracking-category-cite-error-desc": "Pages in this category have errors in the usage of references tags.",
"cite_reference_link_key_with_num": "$1_$2",
"cite_reference_link_prefix": "cite_ref-",
"cite_reference_link_suffix": "",
"cite_references_link_prefix": "cite_note-",
"cite_references_link_suffix": "",
"cite_reference_backlink_symbol": "↑",
"cite_reference_link": "<sup id=\"$1\" class=\"reference\">[[#$2|&#91;$3&#93;]]</sup>",
"cite_references_link_one": "<li id=\"$1\"$4><span class=\"mw-cite-backlink\">[[#$2|↑]]</span> $3</li>",

View file

@ -42,11 +42,8 @@
"cite_error_empty_references_define": "Error message shown when there is a <code>&lt;ref&gt;</code> inside <code>&lt;references&gt;</code>, but it does not have any content, e.g.\n<pre>\n<references>\n<ref name=\"foo\" />\n</references>\n</pre>\nParameters:\n* $1 - the <code><nowiki>name</nowiki></code> of the erroneous <code>&lt;ref&gt;</code> (in the above example, “foo”)",
"cite-tracking-category-cite-error": "{{tracking category name}}\nTracking category name.",
"cite-tracking-category-cite-error-desc": "Tracking category description.",
"cite_reference_link_key_with_num": "{{notranslate}}\n\nParameters:\n* $1 - the key\n* $2 - the number of the key",
"cite_reference_link_prefix": "{{notranslate}}",
"cite_reference_link_suffix": "{{notranslate}}",
"cite_references_link_prefix": "{{notranslate}}",
"cite_references_link_suffix": "{{ignored}}",
"cite_reference_backlink_symbol": "{{optional}}\nSymbol used for the reference section, used to link back to where the reference is used.",
"cite_reference_link": "{{notranslate}}\n\nParameters:\n* $1 - ref key\n* $2 - references key\n* $3 - link label",
"cite_references_link_one": "{{notranslate}}\n\nParameters:\n* $1 - references key\n* $2 - ref key\n* $3 - reference text\n* $4 - optional CSS class for direction",

View file

@ -5,8 +5,7 @@
*/
( function () {
/**
* Checks if the ID uses a composite format that does not only consist of a sequential number,
* as specified in "cite_reference_link_key_with_num".
* Checks if the ID uses a composite format that does not only consist of a sequential number.
*
* @param {string} id
* @return {boolean}

View file

@ -27,13 +27,10 @@ class AnchorFormatter {
*/
private function refKey( string $key, ?string $num ): string {
$prefix = $this->messageLocalizer->msg( 'cite_reference_link_prefix' )->plain();
$suffix = $this->messageLocalizer->msg( 'cite_reference_link_suffix' )->plain();
if ( $num !== null ) {
$key = $this->messageLocalizer->msg( 'cite_reference_link_key_with_num', $key, $num )
->plain();
$key .= '_' . $num;
}
return $this->normalizeKey( $prefix . $key . $suffix );
return $this->normalizeKey( $prefix . $key );
}
/**
@ -71,9 +68,7 @@ class AnchorFormatter {
*/
private function getReferencesKey( string $key ): string {
$prefix = $this->messageLocalizer->msg( 'cite_references_link_prefix' )->plain();
$suffix = $this->messageLocalizer->msg( 'cite_references_link_suffix' )->plain();
return $this->normalizeKey( $prefix . $key . $suffix );
return $this->normalizeKey( $prefix . $key );
}
/**

View file

@ -38,11 +38,10 @@ class AnchorFormatterTest extends \MediaWikiIntegrationTestCase {
$formatter = new AnchorFormatter( $mockMessageLocalizer );
$this->assertSame(
'(cite_reference_link_prefix)key(cite_reference_link_suffix)',
'(cite_reference_link_prefix)key',
$formatter->backLink( 'key', null ) );
$this->assertSame(
'(cite_reference_link_prefix)' .
'(cite_reference_link_key_with_num&#124;key&#124;2)(cite_reference_link_suffix)',
'(cite_reference_link_prefix)key_2',
$formatter->backLink( 'key', '2' ) );
}
@ -62,7 +61,7 @@ class AnchorFormatterTest extends \MediaWikiIntegrationTestCase {
$formatter = new AnchorFormatter( $mockMessageLocalizer );
$this->assertSame(
'(cite_references_link_prefix)key(cite_references_link_suffix)',
'(cite_references_link_prefix)key',
$formatter->jumpLink( 'key' ) );
}