From ad56220cc45dbfe050358370c55e84b058d2f51f Mon Sep 17 00:00:00 2001 From: WMDE-Fisch Date: Tue, 8 Oct 2024 12:06:58 +0200 Subject: [PATCH] Rename remaining Reference Previews i18n keys This is just a minor optimization. The keys should now all follow the schema for Reference Previews in this extension. I'm not touching the `popups-prefs-conflicting-gadgets-info` key. That one was not copied over to this codebase and IMO we could really remove it for the reasons in that comment. Bug: T355194 Change-Id: I1948cf0aaca4d0ab3676bac806c7287568db8712 --- i18n/en.json | 10 +++++----- i18n/qqq.json | 10 +++++----- src/Hooks/CiteHooks.php | 8 ++++---- tests/phpunit/CiteHooksTest.php | 7 +++---- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 9af0a9e6a..e6897a6c6 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -49,6 +49,10 @@ "cite-reference-previews-note": "Note", "cite-reference-previews-web": "Web reference", "cite-reference-previews-collapsible-placeholder": "This reference includes a figure which does not fit in the preview.", + "cite-reference-previews-gadget-conflict-info-navpopups": "You have the [[$1|Navigation popups]] gadget enabled, so you won't see previews provided by this feature. Depending on your wiki, the gadget may have a slightly different name. If you continue to experience issues, please review your gadgets and user scripts, including global ones.", + "cite-reference-previews-gadget-conflict-info-reftooltips": "You have the [[$1|Reference Tooltips]] gadget enabled, so you won't see reference previews but will still see page previews. Depending on your wiki, the gadget may have a slightly different name. If you continue to experience issues, please review your gadgets and user scripts, including global ones.", + "cite-reference-previews-gadget-conflict-info-navpopups-reftooltips": "You have the [[$1|Navigation popups]] and [[$1|Reference Tooltips]] gadgets enabled, so you won't see previews provided by this feature. Depending on your wiki, the gadgets may have slightly different names. If you continue to experience issues, please review your gadgets and user scripts, including global ones.", + "cite-reference-previews-preference-label": "Enable reference previews (get quick previews of a reference while reading a page)", "cite_reference_backlink_symbol": "↑", "cite_reference_link": "[[#$2|[$3]]]", "cite_references_link_one": "
  • [[#$2|↑]] $3
  • ", @@ -80,9 +84,5 @@ "cite-wikieditor-help-content-reference-example-ref-reuse": "", "cite-wikieditor-help-content-reference-example-ref-extends": "$2", "cite-wikieditor-help-content-reference-example-ref-result": "[$1]", - "cite-wikieditor-help-content-reference-example-reflist": "", - "popups-prefs-navpopups-gadget-conflict-info": "You have the [[$1|Navigation popups]] gadget enabled, so you won't see previews provided by this feature. Depending on your wiki, the gadget may have a slightly different name. If you continue to experience issues, please review your gadgets and user scripts, including global ones.", - "popups-prefs-reftooltips-and-navpopups-gadget-conflict-info": "You have the [[$1|Navigation popups]] and [[$1|Reference Tooltips]] gadgets enabled, so you won't see previews provided by this feature. Depending on your wiki, the gadgets may have slightly different names. If you continue to experience issues, please review your gadgets and user scripts, including global ones.", - "popups-prefs-reftooltips-gadget-conflict-info": "You have the [[$1|Reference Tooltips]] gadget enabled, so you won't see reference previews but will still see page previews. Depending on your wiki, the gadget may have a slightly different name. If you continue to experience issues, please review your gadgets and user scripts, including global ones.", - "popups-refpreview-user-preference-label": "Enable reference previews (get quick previews of a reference while reading a page)" + "cite-wikieditor-help-content-reference-example-reflist": "" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 74fb28a66..9a9261e8b 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -54,6 +54,10 @@ "cite-reference-previews-note": "Heading for a popup previewing a footnote.\n{{Identical|Note}}", "cite-reference-previews-web": "Heading for a popup previewing a citation from a website.\n{{Identical|Website}}", "cite-reference-previews-collapsible-placeholder": "Placeholder text for collapsible tables, templates, or other large elements inside of a reference.", + "cite-reference-previews-gadget-conflict-info-navpopups": "Help message telling to disable the \"Navigation popups\" gadget in order to allow page and reference previews. The word \"Gadgets\" should be based on {{msg-mw|prefs-gadgets}}.\n\nParameters:\n* $1 – Link to the Gadgets tab in the user's preferences", + "cite-reference-previews-gadget-conflict-info-navpopups-reftooltips": "Help message telling to disable the \"Navigation popups\" and \"Reference Tooltips\" gadgets in order to allow page and reference previews. The word \"Gadgets\" should be based on {{msg-mw|prefs-gadgets}}.\n\nParameters:\n* $1 – Link to the Gadgets tab in the user's preferences", + "cite-reference-previews-gadget-conflict-info-reftooltips": "Help message telling to disable the \"Reference Tooltips\" gadget in order to allow reference previews. The word \"Gadgets\" should be based on {{msg-mw|prefs-gadgets}}.\n\nParameters:\n* $1 – Link to the Gadgets tab in the user's preferences", + "cite-reference-previews-preference-label": "Label for the user option to enable or disable reference preview popups", "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", @@ -85,9 +89,5 @@ "cite-wikieditor-help-content-reference-example-ref-reuse": "{{ignored}}", "cite-wikieditor-help-content-reference-example-ref-extends": "{{ignored}}", "cite-wikieditor-help-content-reference-example-ref-result": "{{ignored}}", - "cite-wikieditor-help-content-reference-example-reflist": "{{ignored}}", - "popups-prefs-navpopups-gadget-conflict-info": "Help message telling to disable the \"Navigation popups\" gadget in order to allow page and reference previews. The word \"Gadgets\" should be based on {{msg-mw|prefs-gadgets}}.\n\nParameters:\n* $1 – Link to the Gadgets tab in the user's preferences", - "popups-prefs-reftooltips-and-navpopups-gadget-conflict-info": "Help message telling to disable the \"Navigation popups\" and \"Reference Tooltips\" gadgets in order to allow page and reference previews. The word \"Gadgets\" should be based on {{msg-mw|prefs-gadgets}}.\n\nParameters:\n* $1 – Link to the Gadgets tab in the user's preferences", - "popups-prefs-reftooltips-gadget-conflict-info": "Help message telling to disable the \"Reference Tooltips\" gadget in order to allow reference previews. The word \"Gadgets\" should be based on {{msg-mw|prefs-gadgets}}.\n\nParameters:\n* $1 – Link to the Gadgets tab in the user's preferences", - "popups-refpreview-user-preference-label": "Label for the user option to enable or disable reference preview popups" + "cite-wikieditor-help-content-reference-example-reflist": "{{ignored}}" } diff --git a/src/Hooks/CiteHooks.php b/src/Hooks/CiteHooks.php index 5e35a9c61..c0cc77361 100644 --- a/src/Hooks/CiteHooks.php +++ b/src/Hooks/CiteHooks.php @@ -186,7 +186,7 @@ class CiteHooks implements public function onGetPreferences( $user, &$prefs ) { $option = [ 'type' => 'toggle', - 'label-message' => 'popups-refpreview-user-preference-label', + 'label-message' => 'cite-reference-previews-preference-label', // FIXME: This message is unnecessary and unactionable since we already // detect specific gadget conflicts. 'help-message' => 'popups-prefs-conflicting-gadgets-info', @@ -197,15 +197,15 @@ class CiteHooks implements $isRefTooltipsGadgetEnabled = $this->gadgetsIntegration->isRefTooltipsGadgetEnabled( $user ); if ( $isNavPopupsGadgetEnabled && $isRefTooltipsGadgetEnabled ) { $option[ 'disabled' ] = true; - $option[ 'help-message' ] = [ 'popups-prefs-reftooltips-and-navpopups-gadget-conflict-info', + $option[ 'help-message' ] = [ 'cite-reference-previews-gadget-conflict-info-navpopups-reftooltips', 'Special:Preferences#mw-prefsection-gadgets' ]; } elseif ( $isNavPopupsGadgetEnabled ) { $option[ 'disabled' ] = true; - $option[ 'help-message' ] = [ 'popups-prefs-navpopups-gadget-conflict-info', + $option[ 'help-message' ] = [ 'cite-reference-previews-gadget-conflict-info-navpopups', 'Special:Preferences#mw-prefsection-gadgets' ]; } elseif ( $isRefTooltipsGadgetEnabled ) { $option[ 'disabled' ] = true; - $option[ 'help-message' ] = [ 'popups-prefs-reftooltips-gadget-conflict-info', + $option[ 'help-message' ] = [ 'cite-reference-previews-gadget-conflict-info-reftooltips', 'Special:Preferences#mw-prefsection-gadgets' ]; } diff --git a/tests/phpunit/CiteHooksTest.php b/tests/phpunit/CiteHooksTest.php index 5f6bdcac4..5b66cd24a 100644 --- a/tests/phpunit/CiteHooksTest.php +++ b/tests/phpunit/CiteHooksTest.php @@ -92,7 +92,7 @@ class CiteHooksTest extends \MediaWikiIntegrationTestCase { $expected = [ 'popups-reference-previews' => [ 'type' => 'toggle', - 'label-message' => 'popups-refpreview-user-preference-label', + 'label-message' => 'cite-reference-previews-preference-label', 'help-message' => 'popups-prefs-conflicting-gadgets-info', 'section' => 'rendering/reading' ] @@ -112,10 +112,9 @@ class CiteHooksTest extends \MediaWikiIntegrationTestCase { $expected = [ 'popups-reference-previews' => [ 'type' => 'toggle', - 'label-message' => 'popups-refpreview-user-preference-label', - // 'help-message' => 'popups-prefs-conflicting-gadgets-info', + 'label-message' => 'cite-reference-previews-preference-label', 'help-message' => [ - 'popups-prefs-navpopups-gadget-conflict-info', + 'cite-reference-previews-gadget-conflict-info-navpopups', 'Special:Preferences#mw-prefsection-gadgets', ], 'section' => 'rendering/reading',