Merge "Add translateable tooltip message for CodeMirror button"

This commit is contained in:
jenkins-bot 2015-08-11 03:46:06 +00:00 committed by Gerrit Code Review
commit 745b2f05e1
4 changed files with 19 additions and 5 deletions

View file

@ -54,6 +54,10 @@ $wgResourceModules['ext.CodeMirror.init'] = $wgCodeMirrorResourceTemplate + arra
'scripts' => array(
'ext.CodeMirror.js'
),
'messages' => array(
'codemirror-enable-label',
'codemirror-disable-label',
),
'group' => 'ext.CodeMirror',
);

View file

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

View file

@ -7,5 +7,7 @@
"Shirayuki"
]
},
"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-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."
}

View file

@ -205,6 +205,8 @@
*/
addCodeMirrorToWikiEditor = function () {
if ( $( '#wikiEditor-section-main' ).length > 0 ) {
var msg = codeMirror ? 'codemirror-disable-label' : 'codemirror-enable-label';
$( '#wpTextbox1' ).wikiEditor(
'addToToolbar',
{
@ -213,7 +215,7 @@
'codemirror':{
'tools': {
'CodeMirror': {
label: 'CodeMirror',
label: mw.msg( msg ),
type: 'button',
// FIXME: There should be a better way?
icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/cm-' + ( codeMirror ? 'on.png' : 'off.png' ),
@ -269,11 +271,15 @@
codeMirror = false;
$.fn.textSelection = origTextSelection;
$src = mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/' + ( context ? 'cm-off.png' : 'old-cm-off.png' );
$img.attr( 'src', $src );
$img
.attr( 'src', $src )
.attr( 'title', mw.msg( 'codemirror-enable-label' ) );
} else {
enableCodeMirror();
$src = mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/' + ( context ? 'cm-on.png' : 'old-cm-on.png' );
$img.attr( 'src', $src );
$img
.attr( 'src', $src )
.attr( 'title', mw.msg( 'codemirror-disable-label' ) );
setCodeEditorPreference( true );
}
}