diff --git a/extension.json b/extension.json index c592dab2..95750609 100644 --- a/extension.json +++ b/extension.json @@ -37,8 +37,7 @@ "ext.CodeMirror.less" ], "messages": [ - "codemirror-enable-label", - "codemirror-disable-label" + "codemirror-toggle-label" ] }, "ext.CodeMirror.lib": { diff --git a/i18n/en.json b/i18n/en.json index 425efafb..4ed7044d 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -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" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 81cc8904..d2979df4 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -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." } diff --git a/resources/ext.CodeMirror.js b/resources/ext.CodeMirror.js index 81496192..a47378a7 100644 --- a/resources/ext.CodeMirror.js +++ b/resources/ext.CodeMirror.js @@ -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();