Use consistent label for button across editors

Change-Id: I1a299522e95cdb4a6e5bdbdda1c65d4fcec22133
This commit is contained in:
Ed Sanders 2017-04-27 13:37:26 +01:00
parent 7b01a98ad0
commit de6b08919b
4 changed files with 5 additions and 20 deletions

View file

@ -37,8 +37,7 @@
"ext.CodeMirror.less"
],
"messages": [
"codemirror-enable-label",
"codemirror-disable-label"
"codemirror-toggle-label"
]
},
"ext.CodeMirror.lib": {

View file

@ -5,7 +5,5 @@
]
},
"codemirror-desc": "Provides syntax highlighting in wikitext editor",
"codemirror-enable-label": "Enable CodeMirror (Syntax highlight)",
"codemirror-disable-label": "Disable CodeMirror (Syntax highlight)",
"codemirror-toggle-label": "Syntax highlighting"
}

View file

@ -8,7 +8,5 @@
]
},
"codemirror-desc": "{{desc|name=Code Mirror|url=https://www.mediawiki.org/wiki/Extension:CodeMirror}}\n\nAdditional info: Discription of \"Syntax highlighting\" in wiki\n[[mw:Extension:SyntaxHighlight GeSHi]]",
"codemirror-enable-label": "Title tooltip for button to enable CodeMirror in the editing toolbar.",
"codemirror-disable-label": "Title tooltip for button to disable CodeMirror in the editing toolbar.",
"codemirror-toggle-label": "Title tooltip for button to toggle CodeMirror in the editing toolbar."
}

View file

@ -251,7 +251,7 @@
codemirror: {
tools: {
CodeMirror: {
label: mw.msg( useCodeMirror ? 'codemirror-disable-label' : 'codemirror-enable-label' ),
label: mw.msg( 'codemirror-toggle-label' ),
type: 'button',
offset: [ 2, 2 ],
action: {
@ -313,24 +313,14 @@
* @param {Object} [wikiEditor] WikiEditor, if present
*/
function updateToolbarButton( wikiEditor ) {
var label;
if ( useCodeMirror ) {
label = mw.msg( 'codemirror-disable-label' );
} else {
label = mw.msg( 'codemirror-enable-label' );
}
if ( wikiEditor ) {
wikiEditor.modules.toolbar.$toolbar.find( 'a.tool[rel=CodeMirror]' )
.toggleClass( 'tool-codemirror-on', !!useCodeMirror )
.toggleClass( 'tool-codemirror-off', !useCodeMirror )
.attr( 'title', label );
.toggleClass( 'tool-codemirror-off', !useCodeMirror );
} else {
$( '#mw-editbutton-codemirror' )
.toggleClass( 'mw-editbutton-codemirror-on', !!useCodeMirror )
.toggleClass( 'mw-editbutton-codemirror-off', !useCodeMirror )
.attr( 'title', label );
.toggleClass( 'mw-editbutton-codemirror-off', !useCodeMirror );
}
}
@ -408,7 +398,7 @@
mw.loader.using( 'mediawiki.toolbar', function () {
// If WikiEditor isn't enabled, add CodeMirror button to the default wiki editor toolbar
mw.toolbar.addButton( {
speedTip: 'CodeMirror',
speedTip: mw.msg( 'codemirror-toggle-label' ),
imageId: 'mw-editbutton-codemirror',
onClick: function () {
switchCodeMirror();