Merge "EditModeTool: Use state-describing, not action-describing labels"

This commit is contained in:
jenkins-bot 2017-04-26 18:42:42 +00:00 committed by Gerrit Code Review
commit a93888afd5
4 changed files with 11 additions and 30 deletions

View file

@ -1136,7 +1136,6 @@
"visualeditor-editingtabdialog-ok", "visualeditor-editingtabdialog-ok",
"visualeditor-editingtabdialog-title", "visualeditor-editingtabdialog-title",
"visualeditor-mweditmode-tooltip", "visualeditor-mweditmode-tooltip",
"visualeditor-mweditmodesource-tool",
"visualeditor-mweditmodesource-tool-current", "visualeditor-mweditmodesource-tool-current",
"visualeditor-mweditmodesource-tool-unavailable", "visualeditor-mweditmodesource-tool-unavailable",
"visualeditor-mweditmodesource-warning-cancel", "visualeditor-mweditmodesource-warning-cancel",
@ -1146,7 +1145,6 @@
"visualeditor-mweditmodeve-popup-title", "visualeditor-mweditmodeve-popup-title",
"visualeditor-mweditmodeve-showagain", "visualeditor-mweditmodeve-showagain",
"visualeditor-mweditmodeve-title", "visualeditor-mweditmodeve-title",
"visualeditor-mweditmodeve-tool",
"visualeditor-mweditmodeve-tool-current", "visualeditor-mweditmodeve-tool-current",
"visualeditor-mweditmodeve-tool-unavailable", "visualeditor-mweditmodeve-tool-unavailable",
"visualeditor-mweditmodeve-warning", "visualeditor-mweditmodeve-warning",

View file

@ -275,7 +275,6 @@
"visualeditor-mweditmode-tooltip": "Switch editor", "visualeditor-mweditmode-tooltip": "Switch editor",
"visualeditor-mweditmodesource-progress": "Switching to source editing…", "visualeditor-mweditmodesource-progress": "Switching to source editing…",
"visualeditor-mweditmodesource-title": "Switch to source editing?", "visualeditor-mweditmodesource-title": "Switch to source editing?",
"visualeditor-mweditmodesource-tool": "Switch to source editing",
"visualeditor-mweditmodesource-tool-current": "Source editing", "visualeditor-mweditmodesource-tool-current": "Source editing",
"visualeditor-mweditmodesource-tool-unavailable": "Source editing is not available here", "visualeditor-mweditmodesource-tool-unavailable": "Source editing is not available here",
"visualeditor-mweditmodesource-warning": "You are switching to source editing.\nDo you want to continue?", "visualeditor-mweditmodesource-warning": "You are switching to source editing.\nDo you want to continue?",
@ -287,7 +286,6 @@
"visualeditor-mweditmodeve-progress": "Switching to visual editing…", "visualeditor-mweditmodeve-progress": "Switching to visual editing…",
"visualeditor-mweditmodeve-showagain": "Don't show this message again", "visualeditor-mweditmodeve-showagain": "Don't show this message again",
"visualeditor-mweditmodeve-title": "Switch to visual editing?", "visualeditor-mweditmodeve-title": "Switch to visual editing?",
"visualeditor-mweditmodeve-tool": "Switch to visual editing",
"visualeditor-mweditmodeve-tool-current": "Visual editing", "visualeditor-mweditmodeve-tool-current": "Visual editing",
"visualeditor-mweditmodeve-tool-unavailable": "Visual editing is not available here", "visualeditor-mweditmodeve-tool-unavailable": "Visual editing is not available here",
"visualeditor-mweditmodeve-warning": "You are switching to visual editing.\nDo you want to continue?", "visualeditor-mweditmodeve-warning": "You are switching to visual editing.\nDo you want to continue?",

View file

@ -288,8 +288,7 @@
"visualeditor-mweditmode-tooltip": "Tooltip text for editor switching menu.", "visualeditor-mweditmode-tooltip": "Tooltip text for editor switching menu.",
"visualeditor-mweditmodesource-progress": "Title of progress bar shown while switching to source mode.", "visualeditor-mweditmodesource-progress": "Title of progress bar shown while switching to source mode.",
"visualeditor-mweditmodesource-title": "Title of dialog to confirm switching to source mode.", "visualeditor-mweditmodesource-title": "Title of dialog to confirm switching to source mode.",
"visualeditor-mweditmodesource-tool": "Label for tool that changes edit mode to source editing.", "visualeditor-mweditmodesource-tool-current": "Label for tool that changes edit mode to source editing (or describes the mode if the user is already in that mode).",
"visualeditor-mweditmodesource-tool-current": "Label for tool that changes edit mode to source editing if the user is already in that mode.",
"visualeditor-mweditmodesource-tool-unavailable": "'''Please translate \"Source\" as meaning \"Source codes\", not source of references.''' Label for tool that changes edit mode to source editing when it is not available.", "visualeditor-mweditmodesource-tool-unavailable": "'''Please translate \"Source\" as meaning \"Source codes\", not source of references.''' Label for tool that changes edit mode to source editing when it is not available.",
"visualeditor-mweditmodesource-warning": "Warning message show before changing edit mode to source editing. It may allow the user to keep the changes using the message {{msg-mw|Visualeditor-mweditmodesource-warning-switch}} or cancel.", "visualeditor-mweditmodesource-warning": "Warning message show before changing edit mode to source editing. It may allow the user to keep the changes using the message {{msg-mw|Visualeditor-mweditmodesource-warning-switch}} or cancel.",
"visualeditor-mweditmodesource-warning-cancel": "Label for the button on the confirmation dialog for switching to source editing to cancel and return to editing.\n{{Identical|Cancel}}", "visualeditor-mweditmodesource-warning-cancel": "Label for the button on the confirmation dialog for switching to source editing to cancel and return to editing.\n{{Identical|Cancel}}",
@ -300,8 +299,7 @@
"visualeditor-mweditmodeve-progress": "Title of progress bar shown while switching to visual mode.", "visualeditor-mweditmodeve-progress": "Title of progress bar shown while switching to visual mode.",
"visualeditor-mweditmodeve-showagain": "Label for the checkboxes to not show one of the 'switched to visual mode' or 'switched to source mode' popups again", "visualeditor-mweditmodeve-showagain": "Label for the checkboxes to not show one of the 'switched to visual mode' or 'switched to source mode' popups again",
"visualeditor-mweditmodeve-title": "Title of dialog to confirm switching to visual mode.", "visualeditor-mweditmodeve-title": "Title of dialog to confirm switching to visual mode.",
"visualeditor-mweditmodeve-tool": "Label for tool that changes edit mode to visual editing.", "visualeditor-mweditmodeve-tool-current": "Label for tool that changes edit mode to visual editing (or describes the mode if the user is already in that mode).",
"visualeditor-mweditmodeve-tool-current": "Label for tool that changes edit mode to visual editing if the user is already in that mode.",
"visualeditor-mweditmodeve-tool-unavailable": "Label for tool that changes edit mode to visual editing when it is not available.", "visualeditor-mweditmodeve-tool-unavailable": "Label for tool that changes edit mode to visual editing when it is not available.",
"visualeditor-mweditmodeve-warning": "Warning message show before changing edit mode to visual editing. It may allow the user to keep the changes using the message {{msg-mw|Visualeditor-mweditmodesource-warning-switch}}, or instaed that they'd need to start source editing from scratch using {{msg-mw|Visualeditor-mweditmodesource-warning-switch-discard}}.", "visualeditor-mweditmodeve-warning": "Warning message show before changing edit mode to visual editing. It may allow the user to keep the changes using the message {{msg-mw|Visualeditor-mweditmodesource-warning-switch}}, or instaed that they'd need to start source editing from scratch using {{msg-mw|Visualeditor-mweditmodesource-warning-switch-discard}}.",
"visualeditor-mweditmodewt-popup-body": "Body text of popup shown after switching to visual mode from source mode", "visualeditor-mweditmodewt-popup-body": "Body text of popup shown after switching to visual mode from source mode",

View file

@ -38,8 +38,6 @@ mw.libs.ve.MWEditModeTool.static.autoAddToCatchall = false;
mw.libs.ve.MWEditModeTool.static.autoAddToGroup = false; mw.libs.ve.MWEditModeTool.static.autoAddToGroup = false;
mw.libs.ve.MWEditModeTool.static.currentTitle = null;
mw.libs.ve.MWEditModeTool.static.unavailableTooltip = null; mw.libs.ve.MWEditModeTool.static.unavailableTooltip = null;
/* Methods */ /* Methods */
@ -82,32 +80,25 @@ mw.libs.ve.MWEditModeTool.prototype.onSelect = function () {
if ( this.getMode() !== this.constructor.static.editMode ) { if ( this.getMode() !== this.constructor.static.editMode ) {
this.switch(); this.switch();
} }
this.setActive( this.getMode() === this.constructor.static.editMode );
}; };
/** /**
* @inheritdoc * @inheritdoc
*/ */
mw.libs.ve.MWEditModeTool.prototype.onUpdateState = function () { mw.libs.ve.MWEditModeTool.prototype.onUpdateState = function () {
var titleKey, var modeAvailable = this.isModeAvailable( this.constructor.static.editMode );
modeAvailable = this.isModeAvailable( this.constructor.static.editMode ),
isCurrent = this.getMode() === this.constructor.static.editMode;
// Change title if state has changed // Change title if state has changed
if ( this.isCurrent !== isCurrent || this.modeAvailable !== modeAvailable ) { if ( this.modeAvailable !== modeAvailable ) {
titleKey = isCurrent ? this.$link.attr( 'title', modeAvailable ?
this.constructor.static.currentTitle : OO.ui.resolveMsg( this.constructor.static.title ) :
this.constructor.static.title; OO.ui.resolveMsg( this.constructor.static.unavailableTooltip )
this.setTitle( OO.ui.resolveMsg( titleKey ) ); );
// Change tooltip if mode is unavailable
if ( !modeAvailable ) {
this.$link.attr( 'title', OO.ui.resolveMsg( this.constructor.static.unavailableTooltip ) );
}
this.modeAvailable = modeAvailable;
this.isCurrent = isCurrent;
}
// Update disabled and active state
this.setDisabled( !modeAvailable ); this.setDisabled( !modeAvailable );
this.setActive( isCurrent ); this.modeAvailable = modeAvailable;
}
this.setActive( this.getMode() === this.constructor.static.editMode );
}; };
/** /**
@ -128,8 +119,6 @@ mw.libs.ve.MWEditModeSourceTool.static.editMode = 'source';
mw.libs.ve.MWEditModeSourceTool.static.name = 'editModeSource'; mw.libs.ve.MWEditModeSourceTool.static.name = 'editModeSource';
mw.libs.ve.MWEditModeSourceTool.static.icon = 'wikiText'; mw.libs.ve.MWEditModeSourceTool.static.icon = 'wikiText';
mw.libs.ve.MWEditModeSourceTool.static.title = mw.libs.ve.MWEditModeSourceTool.static.title =
OO.ui.deferMsg( 'visualeditor-mweditmodesource-tool' );
mw.libs.ve.MWEditModeSourceTool.static.currentTitle =
OO.ui.deferMsg( 'visualeditor-mweditmodesource-tool-current' ); OO.ui.deferMsg( 'visualeditor-mweditmodesource-tool-current' );
mw.libs.ve.MWEditModeSourceTool.static.unavailableTooltip = mw.libs.ve.MWEditModeSourceTool.static.unavailableTooltip =
OO.ui.deferMsg( 'visualeditor-mweditmodesource-tool-unavailable' ); OO.ui.deferMsg( 'visualeditor-mweditmodesource-tool-unavailable' );
@ -152,8 +141,6 @@ mw.libs.ve.MWEditModeVisualTool.static.editMode = 'visual';
mw.libs.ve.MWEditModeVisualTool.static.name = 'editModeVisual'; mw.libs.ve.MWEditModeVisualTool.static.name = 'editModeVisual';
mw.libs.ve.MWEditModeVisualTool.static.icon = 'eye'; mw.libs.ve.MWEditModeVisualTool.static.icon = 'eye';
mw.libs.ve.MWEditModeVisualTool.static.title = mw.libs.ve.MWEditModeVisualTool.static.title =
OO.ui.deferMsg( 'visualeditor-mweditmodeve-tool' );
mw.libs.ve.MWEditModeVisualTool.static.currentTitle =
OO.ui.deferMsg( 'visualeditor-mweditmodeve-tool-current' ); OO.ui.deferMsg( 'visualeditor-mweditmodeve-tool-current' );
mw.libs.ve.MWEditModeVisualTool.static.unavailableTooltip = mw.libs.ve.MWEditModeVisualTool.static.unavailableTooltip =
OO.ui.deferMsg( 'visualeditor-mweditmodeve-tool-unavailable' ); OO.ui.deferMsg( 'visualeditor-mweditmodeve-tool-unavailable' );