r75487 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75486‎ | r75487 | r75488 >
Date:23:42, 26 October 2010
Author:tparscal
Status:resolved
Tags:
Comment:
Updated use of mediaWiki.msg to mediaWiki.message
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)
  • /trunk/extensions/Vector/modules/ext.vector.editWarning.js (modified) (history)
  • /trunk/extensions/Vector/modules/ext.vector.simpleSearch.js (modified) (history)
  • /trunk/extensions/WikiEditor/modules/ext.wikiEditor.dialogs.js (modified) (history)
  • /trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js (modified) (history)
  • /trunk/extensions/WikiEditor/modules/jquery.wikiEditor.js (modified) (history)
  • /trunk/extensions/WikiEditor/modules/jquery.wikiEditor.preview.js (modified) (history)
  • /trunk/extensions/WikiEditor/modules/jquery.wikiEditor.publish.js (modified) (history)
  • /trunk/extensions/WikiEditor/modules/jquery.wikiEditor.templateEditor.js (modified) (history)
  • /trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toc.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.templateEditor.js
@@ -316,7 +316,7 @@
317317 </fieldset>',
318318 init: function() {
319319 $(this).find( '[rel]' ).each( function() {
320 - $(this).text( mediaWiki.msg.get( $(this).attr( 'rel' ) ) );
 320+ $(this).text( mediaWiki.message( $(this).attr( 'rel' ) ) );
321321 } );
322322 },
323323 dialog: {
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js
@@ -114,10 +114,10 @@
115115 configuration.title = $.wikiEditor.autoMsg( module, 'title' );
116116 // Transform messages in keys
117117 // Stupid JS won't let us do stuff like
118 - // foo = { mediaWiki.msg.get( 'bar' ): baz }
 118+ // foo = { mediaWiki.message( 'bar' ): baz }
119119 configuration.newButtons = {};
120120 for ( msg in configuration.buttons )
121 - configuration.newButtons[mediaWiki.msg.get( msg )] = configuration.buttons[msg];
 121+ configuration.newButtons[mediaWiki.message( msg )] = configuration.buttons[msg];
122122 configuration.buttons = configuration.newButtons;
123123 // Create the dialog <div>
124124 var dialogDiv = $( '<div />' )
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.js
@@ -115,7 +115,7 @@
116116 return false;
117117 },
118118 /**
119 - * Provides a way to extract messages from objects. Wraps the mediaWiki.msg.get() function, which
 119+ * Provides a way to extract messages from objects. Wraps the mediaWiki.message() function, which
120120 * may eventually become a wrapper for some kind of core MW functionality.
121121 *
122122 * @param object Object to extract messages from
@@ -138,13 +138,10 @@
139139 return object[property];
140140 } else if ( property + 'Msg' in object ) {
141141 var p = object[property + 'Msg'];
142 - if ( p instanceof Array && p.length >= 2 ) {
143 - return mediaWiki.msg.get(
144 - object[property + 'Msg' ][0],
145 - { 'parameters': [object[property + 'Msg' ][1]] }
146 - );
 142+ if ( $.isArray( p ) && p.length >= 2 ) {
 143+ return mediaWiki.message.apply( p ).toString();
147144 } else {
148 - return mediaWiki.msg.get( p );
 145+ return mediaWiki.message( p ).toString();
149146 }
150147 } else {
151148 return '';
@@ -545,7 +542,7 @@
546543 /* Disabling our loading div for now
547544 var $loader = $( '<div></div>' )
548545 .addClass( 'wikiEditor-ui-loading' )
549 - .append( $( '<span>' + mediaWiki.msg.get( 'wikieditor-loading' ) + '</span>' )
 546+ .append( $( '<span>' + mediaWiki.message( 'wikieditor-loading' ) + '</span>' )
550547 .css( 'marginTop', context.$textarea.height() / 2 ) );
551548 */
552549 // Encapsulate the textarea with some containers for layout
Index: trunk/extensions/WikiEditor/modules/ext.wikiEditor.dialogs.js
@@ -220,20 +220,19 @@
221221 updateExistence( true );
222222 });
223223 // Set labels of tabs based on rel values
224 - var msg = mediaWiki.msg;
225224 $(this).find( '[rel]' ).each( function() {
226 - $(this).text( msg.get( $(this).attr( 'rel' ) ) );
 225+ $(this).text( mediaWiki.message( $(this).attr( 'rel' ) ) );
227226 });
228227 // Set tabindexes on form fields
229228 $.wikiEditor.modules.dialogs.fn.setTabindexes( $(this).find( 'input' ).not( '[tabindex]' ) );
230229 // Setup the tooltips in the textboxes
231230 $( '#wikieditor-toolbar-link-int-target' )
232 - .data( 'tooltip', msg.get( 'wikieditor-toolbar-tool-link-int-target-tooltip' ) );
 231+ .data( 'tooltip', mediaWiki.message( 'wikieditor-toolbar-tool-link-int-target-tooltip' ) );
233232 $( '#wikieditor-toolbar-link-int-text' )
234 - .data( 'tooltip', msg.get( 'wikieditor-toolbar-tool-link-int-text-tooltip' ) );
 233+ .data( 'tooltip', mediaWiki.message( 'wikieditor-toolbar-tool-link-int-text-tooltip' ) );
235234 $( '#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text' )
236235 .each( function() {
237 - var tooltip = msg.get( $( this ).attr( 'id' ) + '-tooltip' );
 236+ var tooltip = mediaWiki.message( $( this ).attr( 'id' ) + '-tooltip' );
238237 if ( $( this ).val() == '' )
239238 $( this )
240239 .addClass( 'wikieditor-toolbar-dialog-hint' )
@@ -302,11 +301,11 @@
303302 });
304303 // Add images to the page existence widget, which will be shown mutually exclusively to communicate if
305304 // the page exists, does not exist or the title is invalid (like if it contains a | character)
306 - var existsMsg = msg.get( 'wikieditor-toolbar-tool-link-int-target-status-exists' );
307 - var notexistsMsg = msg.get( 'wikieditor-toolbar-tool-link-int-target-status-notexists' );
308 - var invalidMsg = msg.get( 'wikieditor-toolbar-tool-link-int-target-status-invalid' );
309 - var externalMsg = msg.get( 'wikieditor-toolbar-tool-link-int-target-status-external' );
310 - var loadingMsg = msg.get( 'wikieditor-toolbar-tool-link-int-target-status-loading' );
 305+ var existsMsg = mediaWiki.message( 'wikieditor-toolbar-tool-link-int-target-status-exists' );
 306+ var notexistsMsg = mediaWiki.message( 'wikieditor-toolbar-tool-link-int-target-status-notexists' );
 307+ var invalidMsg = mediaWiki.message( 'wikieditor-toolbar-tool-link-int-target-status-invalid' );
 308+ var externalMsg = mediaWiki.message( 'wikieditor-toolbar-tool-link-int-target-status-external' );
 309+ var loadingMsg = mediaWiki.message( 'wikieditor-toolbar-tool-link-int-target-status-loading' );
311310 $( '#wikieditor-toolbar-link-int-target-status' )
312311 .append( $( '<div />' )
313312 .attr( 'id', 'wikieditor-toolbar-link-int-target-status-exists' )
@@ -423,9 +422,8 @@
424423 target = "";
425424 if ( $( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip-mode' ) )
426425 text = "";
427 - var msg = mediaWiki.msg;
428426 if ( target == '' ) {
429 - alert( msg.get( 'wikieditor-toolbar-tool-link-empty' ) );
 427+ alert( mediaWiki.message( 'wikieditor-toolbar-tool-link-empty' ) );
430428 return;
431429 }
432430 if ( $.trim( text ) == '' ) {
@@ -437,7 +435,7 @@
438436 // FIXME: Exactly how fragile is this?
439437 if ( $( '#wikieditor-toolbar-link-int-target-status-invalid' ).is( ':visible' ) ) {
440438 // Refuse to add links to invalid titles
441 - alert( msg.get( 'wikieditor-toolbar-tool-link-int-invalid' ) );
 439+ alert( mediaWiki.message( 'wikieditor-toolbar-tool-link-int-invalid' ) );
442440 return;
443441 }
444442
@@ -455,12 +453,12 @@
456454 if ( match && !$(this).data( 'ignoreLooksInternal' ) ) {
457455 var buttons = { };
458456 var that = this;
459 - buttons[ msg.get( 'wikieditor-toolbar-tool-link-lookslikeinternal-int' ) ] =
 457+ buttons[ mediaWiki.message( 'wikieditor-toolbar-tool-link-lookslikeinternal-int' ) ] =
460458 function() {
461459 $( '#wikieditor-toolbar-link-int-target' ).val( match[1] ).change();
462460 $(this).dialog( 'close' );
463461 };
464 - buttons[ msg.get( 'wikieditor-toolbar-tool-link-lookslikeinternal-ext' ) ] =
 462+ buttons[ mediaWiki.message( 'wikieditor-toolbar-tool-link-lookslikeinternal-ext' ) ] =
465463 function() {
466464 $(that).data( 'ignoreLooksInternal', true );
467465 $(that).closest( '.ui-dialog' ).find( 'button:first' ).click();
@@ -468,7 +466,7 @@
469467 $(this).dialog( 'close' );
470468 };
471469 $.wikiEditor.modules.dialogs.quickDialog(
472 - msg.get( 'wikieditor-toolbar-tool-link-lookslikeinternal', match[1] ),
 470+ mediaWiki.message( 'wikieditor-toolbar-tool-link-lookslikeinternal', match[1] ),
473471 { buttons: buttons }
474472 );
475473 return;
@@ -617,7 +615,7 @@
618616 init: function() {
619617 // Insert translated strings into labels
620618 $( this ).find( '[rel]' ).each( function() {
621 - $( this ).text( mediaWiki.msg.get( $( this ).attr( 'rel' ) ) );
 619+ $( this ).text( mediaWiki.message( $( this ).attr( 'rel' ) ) );
622620 } );
623621
624622 },
@@ -761,7 +759,7 @@
762760 </div></div>',
763761 init: function() {
764762 $(this).find( '[rel]' ).each( function() {
765 - $(this).text( mediaWiki.msg.get( $(this).attr( 'rel' ) ) );
 763+ $(this).text( mediaWiki.message( $(this).attr( 'rel' ) ) );
766764 });
767765 // Set tabindexes on form fields
768766 $.wikiEditor.modules.dialogs.fn.setTabindexes( $(this).find( 'input' ).not( '[tabindex]' ) );
@@ -821,21 +819,20 @@
822820 var rows = parseInt( rowsVal, 10 );
823821 var cols = parseInt( colsVal, 10 );
824822 var header = $( '#wikieditor-toolbar-table-dimensions-header' ).is( ':checked' ) ? 1 : 0;
825 - var msg = mediaWiki.msg;
826823 if ( isNaN( rows ) || isNaN( cols ) || rows != rowsVal || cols != colsVal ) {
827 - alert( msg.get( 'wikieditor-toolbar-tool-table-invalidnumber' ) );
 824+ alert( mediaWiki.message( 'wikieditor-toolbar-tool-table-invalidnumber' ) );
828825 return;
829826 }
830827 if ( rows + header == 0 || cols == 0 ) {
831 - alert( msg.get( 'wikieditor-toolbar-tool-table-zero' ) );
 828+ alert( mediaWiki.message( 'wikieditor-toolbar-tool-table-zero' ) );
832829 return;
833830 }
834831 if ( rows * cols > 1000 ) {
835 - alert( msg.get( 'wikieditor-toolbar-tool-table-toomany', 1000 ) );
 832+ alert( mediaWiki.message( 'wikieditor-toolbar-tool-table-toomany', 1000 ) );
836833 return;
837834 }
838 - var headerText = msg.get( 'wikieditor-toolbar-tool-table-example-header' );
839 - var normalText = msg.get( 'wikieditor-toolbar-tool-table-example' );
 835+ var headerText = mediaWiki.message( 'wikieditor-toolbar-tool-table-example-header' );
 836+ var normalText = mediaWiki.message( 'wikieditor-toolbar-tool-table-example' );
840837 var table = "";
841838 for ( var r = 0; r < rows + header; r++ ) {
842839 table += "|-\n";
@@ -958,9 +955,8 @@
959956 </div>\
960957 </fieldset>',
961958 init: function() {
962 - var msg = mediaWiki.msg;
963959 $(this).find( '[rel]' ).each( function() {
964 - $(this).text( msg.get( $(this).attr( 'rel' ) ) );
 960+ $(this).text( mediaWiki.message( $(this).attr( 'rel' ) ) );
965961 });
966962 // Set tabindexes on form fields
967963 $.wikiEditor.modules.dialogs.fn.setTabindexes( $(this).find( 'input' ).not( '[tabindex]' ) );
@@ -990,7 +986,7 @@
991987 var regex = new RegExp( searchStr, flags );
992988 } catch( e ) {
993989 $( '#wikieditor-toolbar-replace-invalidregex' )
994 - .text( msg.get( 'wikieditor-toolbar-tool-replace-invalidregex',
 990+ .text( mediaWiki.message( 'wikieditor-toolbar-tool-replace-invalidregex',
995991 e.message ) )
996992 .show();
997993 return;
@@ -1044,7 +1040,7 @@
10451041 offset = newEnd;
10461042 }
10471043 $( '#wikieditor-toolbar-replace-success' )
1048 - .text( msg.get( 'wikieditor-toolbar-tool-replace-success', match.length ) )
 1044+ .text( mediaWiki.message( 'wikieditor-toolbar-tool-replace-success', match.length ) )
10491045 .show();
10501046 $(this).data( 'offset', 0 );
10511047 } else {
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.publish.js
@@ -63,7 +63,7 @@
6464 </div>',
6565 init: function() {
6666 $(this).find( '[rel]' ).each( function() {
67 - $(this).text( mediaWiki.msg.get( $(this).attr( 'rel' ) ) );
 67+ $(this).text( mediaWiki.message( $(this).attr( 'rel' ) ) );
6868 });
6969
7070 /* REALLY DIRTY HACK! */
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.preview.js
@@ -134,7 +134,7 @@
135135 }
136136 } );
137137
138 - var loadingMsg = mediaWiki.msg.get( 'wikieditor-preview-loading' );
 138+ var loadingMsg = mediaWiki.message( 'wikieditor-preview-loading' );
139139 context.modules.preview.$preview
140140 .add( context.$changesTab )
141141 .append( $( '<div />' )
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toc.js
@@ -510,7 +510,7 @@
511511 return false;
512512 } )
513513 .find( 'a' )
514 - .text( mediaWiki.msg.get( 'wikieditor-toc-hide' ) );
 514+ .text( mediaWiki.message( 'wikieditor-toc-hide' ) );
515515 $expandControl
516516 .addClass( 'wikiEditor-ui-toc-expandControl' )
517517 .append( '<a href="#" />' )
@@ -527,7 +527,7 @@
528528 } )
529529 .hide()
530530 .find( 'a' )
531 - .text( mediaWiki.msg.get( 'wikieditor-toc-show' ) );
 531+ .text( mediaWiki.message( 'wikieditor-toc-show' ) );
532532 $collapseControl.insertBefore( context.modules.toc.$toc );
533533 context.$ui.find( '.wikiEditor-ui-left .wikiEditor-ui-top' ).append( $expandControl );
534534 }
Index: trunk/extensions/Vector/modules/ext.vector.editWarning.js
@@ -35,7 +35,7 @@
3636 $( '#wpSummary' ).data( 'origtext' ) != $( '#wpSummary' ).val()
3737 ) {
3838 // Return our message
39 - retval = mediaWiki.msg.get( 'vector-editwarning-warning' );
 39+ retval = mediaWiki.message( 'vector-editwarning-warning' );
4040 }
4141 }
4242
Index: trunk/extensions/Vector/modules/ext.vector.simpleSearch.js
@@ -35,7 +35,7 @@
3636 }
3737
3838 // Placeholder text for SimpleSearch box
39 - $( 'div#simpleSearch > input#searchInput' ).placeholder( mediaWiki.msg.get( 'vector-simplesearch-search' ) );
 39+ $( 'div#simpleSearch > input#searchInput' ).placeholder( mediaWiki.message( 'vector-simplesearch-search' ) );
4040
4141 // General suggestions functionality for all search boxes
4242 $( '#searchInput, #searchInput2, #powerSearchText, #searchText' )
@@ -92,7 +92,7 @@
9393 $(this).show()
9494 $label = $( '<div />' )
9595 .addClass( 'special-label' )
96 - .text( mediaWiki.msg.get( 'vector-simplesearch-containing' ) )
 96+ .text( mediaWiki.message( 'vector-simplesearch-containing' ).toString() )
9797 .appendTo( $(this) );
9898 $query = $( '<div />' )
9999 .addClass( 'special-query' )
Index: trunk/extensions/ProofreadPage/proofread.js
@@ -51,7 +51,7 @@
5252 pageBody = text;
5353 pageFooter = proofreadPageFooter;
5454 if( document.editform ) {
55 - document.editform.elements['wpSummary'].value = '/* ' + mediaWiki.msg.get( 'proofreadpage_quality1_category' ) + ' */ ';
 55+ document.editform.elements['wpSummary'].value = '/* ' + mediaWiki.message( 'proofreadpage_quality1_category' ) + ' */ ';
5656 }
5757 }
5858 }
@@ -125,15 +125,15 @@
126126 container.innerHTML = '' +
127127 '<div id="prp_header" style="">' +
128128 '<span style="color:gray;font-size:80%;line-height:100%;">' +
129 - escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_header' ) ) + '</span>' +
 129+ escapeQuotesHTML( mediaWiki.message( 'proofreadpage_header' ) ) + '</span>' +
130130 '<textarea name="wpHeaderTextbox" rows="2" cols="80" tabindex=1>' + pageHeader + '</textarea><br />' +
131131 '<span style="color:gray;font-size:80%;line-height:100%;">' +
132 - escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_body' ) ) + '</span></div>' +
 132+ escapeQuotesHTML( mediaWiki.message( 'proofreadpage_body' ) ) + '</span></div>' +
133133 '<textarea name="wpTextbox1" id="wpTextbox1" tabindex=1 style="height:' + ( self.DisplayHeight - 6 ) + 'px;">' +
134134 pageBody + '</textarea>' +
135135 '<div id="prp_footer" style="">' +
136136 '<span style="color:gray;font-size:80%;line-height:100%;">' +
137 - escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_footer' ) ) + '</span><br />' +
 137+ escapeQuotesHTML( mediaWiki.message( 'proofreadpage_footer' ) ) + '</span><br />' +
138138 '<textarea name="wpFooterTextbox" rows="2" cols="80" tabindex=1>' +
139139 pageFooter + '</textarea></div>';
140140 }
@@ -775,8 +775,8 @@
776776 image.className = 'mw-toolbar-editbutton';
777777 image.src = wgScriptPath + '/extensions/ProofreadPage/button_category_plus.png';
778778 image.border = 0;
779 - image.alt = mediaWiki.msg.get( 'proofreadpage_toggleheaders' );
780 - image.title = mediaWiki.msg.get( 'proofreadpage_toggleheaders' );
 779+ image.alt = mediaWiki.message( 'proofreadpage_toggleheaders' );
 780+ image.title = mediaWiki.message( 'proofreadpage_toggleheaders' );
781781 image.style.cursor = 'pointer';
782782 image.onclick = pr_toggle_visibility;
783783
@@ -919,19 +919,19 @@
920920 var text = '';
921921 switch( value ) {
922922 case 0:
923 - text = mediaWiki.msg.get( 'proofreadpage_quality0_category' );
 923+ text = mediaWiki.message( 'proofreadpage_quality0_category' );
924924 break;
925925 case 1:
926 - text = mediaWiki.msg.get( 'proofreadpage_quality1_category' );
 926+ text = mediaWiki.message( 'proofreadpage_quality1_category' );
927927 break;
928928 case 2:
929 - text = mediaWiki.msg.get( 'proofreadpage_quality2_category' );
 929+ text = mediaWiki.message( 'proofreadpage_quality2_category' );
930930 break;
931931 case 3:
932 - text = mediaWiki.msg.get( 'proofreadpage_quality3_category' );
 932+ text = mediaWiki.message( 'proofreadpage_quality3_category' );
933933 break;
934934 case 4:
935 - text = mediaWiki.msg.get( 'proofreadpage_quality4_category' );
 935+ text = mediaWiki.message( 'proofreadpage_quality4_category' );
936936 break;
937937 }
938938 form.elements['wpSummary'].value = '/* ' + text + ' */ ';
@@ -963,7 +963,7 @@
964964 +'<span class="quality1"> <input type="radio" name="quality" value=1 onclick="pr_add_quality(this.form,1)" tabindex=4> </span>'
965965 +'<span class="quality3"> <input type="radio" name="quality" value=3 onclick="pr_add_quality(this.form,3)" tabindex=4> </span>'
966966 +'<span class="quality4"> <input type="radio" name="quality" value=4 onclick="pr_add_quality(this.form,4)" tabindex=4> </span>';
967 - f.innerHTML = f.innerHTML + '&nbsp;' + escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_page_status' ) );
 967+ f.innerHTML = f.innerHTML + '&nbsp;' + escapeQuotesHTML( mediaWiki.message( 'proofreadpage_page_status' ) );
968968
969969 if( !( ( self.proofreadpage_quality == 4 ) || ( ( self.proofreadpage_quality == 3 ) && ( self.proofreadpage_username != proofreadPageUserName ) ) ) ) {
970970 document.editform.quality[4].parentNode.style.cssText = 'display:none';

Follow-up revisions

RevisionCommit summaryAuthorDate
r75491Mostly reverted r75487, making use of a new version of mediaWiki.msg.tparscal00:16, 27 October 2010

Status & tagging log