From e0b50f4cfa2ece1fec789eccb59cdd0a7bdce4a7 Mon Sep 17 00:00:00 2001 From: Moriel Schottlender Date: Mon, 17 Jul 2017 15:38:32 -0700 Subject: [PATCH] RCFilters: Correct language for invert button Bug: T166912 Change-Id: Iabbbe2c76d5dc51f2aa49646c84b8eba7bc692a1 --- languages/i18n/en.json | 2 ++ languages/i18n/qqq.json | 2 ++ resources/Resources.php | 2 ++ .../ui/mw.rcfilters.ui.FilterMenuHeaderWidget.js | 16 +++++++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 4d51c9ec3f..64f9b7b90a 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1443,6 +1443,8 @@ "rcfilters-tag-prefix-namespace": ":$1", "rcfilters-tag-prefix-namespace-inverted": ":not $1", "rcfilters-tag-prefix-tags": "#$1", + "rcfilters-exclude-button-off": "Exclude selected", + "rcfilters-exclude-button-on": "Excluding selected", "rcfilters-view-tags": "Tagged edits", "rcfilters-view-namespaces-tooltip": "Filter results by namespace", "rcfilters-view-tags-tooltip": "Filter results using edit tags", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 44335fc77a..d98f8b0abe 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1633,6 +1633,8 @@ "rcfilters-tag-prefix-namespace": "Prefix for the namespace tags in [[Special:RecentChanges]]. Namespace tags use a colon (:) as prefix. Please keep this format.\n\nParameters:\n* $1 - Filter name.", "rcfilters-tag-prefix-namespace-inverted": "Prefix for the namespace inverted tags in [[Special:RecentChanges]]. Namespace tags use a colon (:) as prefix. Please keep this format.\n\nParameters:\n* $1 - Filter name.\n{{Identical|Not}}", "rcfilters-tag-prefix-tags": "Prefix for the edit tags in [[Special:RecentChanges]]. Edit tags use a hash (#) as prefix. Please keep this format.\n\nParameters:\n* $1 - Tag display name.", + "rcfilters-exclude-button-off": "Title for the button that excludes selected namespaces, when it is not yet active.", + "rcfilters-exclude-button-on": "Title for the button that excludes selected namespaces, when it is not yet active.", "rcfilters-view-tags": "Title for the tags view in [[Special:RecentChanges]]\n{{Identical|Tag}}", "rcfilters-view-namespaces-tooltip": "Tooltip for the button that loads the namespace view in [[Special:RecentChanges]]", "rcfilters-view-tags-tooltip": "Tooltip for the button that loads the tags view in [[Special:RecentChanges]]", diff --git a/resources/Resources.php b/resources/Resources.php index a8cf91dee7..afc1c0e3c0 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -1857,6 +1857,8 @@ return [ 'rcfilters-tag-prefix-namespace', 'rcfilters-tag-prefix-namespace-inverted', 'rcfilters-tag-prefix-tags', + 'rcfilters-exclude-button-off', + 'rcfilters-exclude-button-on', 'rcfilters-view-tags', 'rcfilters-view-namespaces-tooltip', 'rcfilters-view-tags-tooltip', diff --git a/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterMenuHeaderWidget.js b/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterMenuHeaderWidget.js index d0ad8d5409..da71d70603 100644 --- a/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterMenuHeaderWidget.js +++ b/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterMenuHeaderWidget.js @@ -44,10 +44,10 @@ // Invert namespaces button this.invertNamespacesButton = new OO.ui.ToggleButtonWidget( { icon: '', - label: mw.msg( 'invert' ), classes: [ 'mw-rcfilters-ui-filterMenuHeaderWidget-invertNamespacesButton' ] } ); this.invertNamespacesButton.toggle( this.model.getCurrentView() === 'namespaces' ); + this.updateInvertButton( this.model.areNamespacesInverted() ); // Events this.backButton.connect( this, { click: 'onBackButtonClick' } ); @@ -127,7 +127,21 @@ * @param {boolean} isInverted Namespaces selection is inverted */ mw.rcfilters.ui.FilterMenuHeaderWidget.prototype.onModelInvertChange = function ( isInverted ) { + this.updateInvertButton( isInverted ); + }; + + /** + * Update the state of the invert button + * + * @param {boolean} isInverted Namespaces selection is inverted + */ + mw.rcfilters.ui.FilterMenuHeaderWidget.prototype.updateInvertButton = function ( isInverted ) { this.invertNamespacesButton.setActive( isInverted ); + this.invertNamespacesButton.setLabel( + isInverted ? + mw.msg( 'rcfilters-exclude-button-on' ) : + mw.msg( 'rcfilters-exclude-button-off' ) + ); }; mw.rcfilters.ui.FilterMenuHeaderWidget.prototype.onBackButtonClick = function () { -- 2.20.1