r77880 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77879‎ | r77880 | r77881 >
Date:15:05, 6 December 2010
Author:tparscal
Status:ok
Tags:
Comment:
Using the new jQuery localize() method for placholder-based localization
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.js
@@ -5,9 +5,6 @@
66 ( function( $, mw ) {
77
88 $.articleFeedback = {
9 - 'cfg': {
10 - 'msgPrefix': 'articlefeedback-beta-',
11 - },
129 'fn': {
1310 'build': function( context ) {
1411 context.$ui
@@ -16,35 +13,35 @@
1714 .append( '\
1815 <div class="articleFeedback-tabs">\
1916 <div class="articleFeedback-tab articleFeedback-tab-current" rel="form">\
20 - <div class="articleFeedback-buffer" msg-text="form-tab-label"></div>\
 17+ <div class="articleFeedback-buffer"><msg key="form-tab-label" /></div>\
2118 </div>\
2219 <div class="articleFeedback-tab" rel="report">\
23 - <div class="articleFeedback-buffer" msg-text="report-tab-label"></div>\
 20+ <div class="articleFeedback-buffer"><msg key="report-tab-label" /></div>\
2421 </div>\
2522 </div>\
2623 <div class="articleFeedback-panel" rel="form">\
2724 <div class="articleFeedback-buffer">\
28 - <div class="articleFeedback-title" msg-text="form-panel-title"></div>\
29 - <div class="articleFeedback-instructions" msg-text="form-panel-instructions"></div>\
 25+ <div class="articleFeedback-title"><msg key="form-panel-title" /></div>\
 26+ <div class="articleFeedback-instructions"><msg key="form-panel-instructions" /></div>\
3027 <div style="clear:both;"></div>\
3128 <div class="articleFeedback-ratings">\
3229 <div class="articleFeedback-rating" rel="wellsourced">\
33 - <span class="articleFeedback-label" msg-text="field-wellsourced-label" msg-tip="field-wellsourced-tip"></span>\
 30+ <span class="articleFeedback-label" title-msg="field-wellsourced-tip"><msg key="field-wellsourced-label" /></span>\
3431 <div class="articleFeedback-rating-fields"><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /></div>\
3532 <div class="articleFeedback-rating-labels"><label></label><label></label><label></label><label></label><label></label></div>\
3633 </div>\
3734 <div class="articleFeedback-rating" rel="neutral">\
38 - <span class="articleFeedback-label" msg-text="field-neutral-label" msg-tip="field-neutral-tip"></span>\
 35+ <span class="articleFeedback-label" title-msg="field-neutral-tip"><msg key="field-neutral-label" /></span>\
3936 <div class="articleFeedback-rating-fields"><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /></div>\
4037 <div class="articleFeedback-rating-labels"><label></label><label></label><label></label><label></label><label></label></div>\
4138 </div>\
4239 <div class="articleFeedback-rating" rel="complete">\
43 - <span class="articleFeedback-label" msg-text="field-complete-label" msg-tip="field-complete-tip"></span>\
 40+ <span class="articleFeedback-label" title-msg="field-complete-tip"><msg key="field-complete-label" /></span>\
4441 <div class="articleFeedback-rating-fields"><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /></div>\
4542 <div class="articleFeedback-rating-labels"><label></label><label></label><label></label><label></label><label></label></div>\
4643 </div>\
4744 <div class="articleFeedback-rating" rel="readable">\
48 - <span class="articleFeedback-label" msg-text="field-readable-label" msg-tip="field-readable-tip"></span>\
 45+ <span class="articleFeedback-label" title-msg="field-readable-tip"><msg key="field-readable-label" /></span>\
4946 <div class="articleFeedback-rating-fields"><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /></div>\
5047 <div class="articleFeedback-rating-labels"><label></label><label></label><label></label><label></label><label></label></div>\
5148 </div>\
@@ -54,23 +51,14 @@
5552 </div>\
5653 <div class="articleFeedback-panel" rel="report">\
5754 <div class="articleFeedback-buffer">\
58 - <div class="articleFeedback-title" msg-text="report-panel-title"></div>\
 55+ <div class="articleFeedback-title"><msg key="report-panel-title" /></div>\
5956 </div>\
6057 </div>\
6158 ' )
62 - // Insert messages
63 - .find( '[msg-text]' )
64 - .each( function() {
65 - $(this).text( $.articleFeedback.fn.msg( $(this).attr( 'msg-text' ) ) );
66 - } )
 59+ .localize( { 'prefix': 'articlefeedback-beta-' } )
 60+ .find( '[title]' )
 61+ .tipsy( { 'gravity': 'sw', 'fade': true } )
6762 .end()
68 - .find( '[msg-tip]' )
69 - .each( function() {
70 - $(this)
71 - .attr( 'title', $.articleFeedback.fn.msg( $(this).attr( 'msg-tip' ) ) )
72 - .tipsy( { 'gravity': 'sw', 'fade': true } );
73 - } )
74 - .end()
7563 // Setup tab behavior
7664 .find( '.articleFeedback-tab' )
7765 .click( function( e ) {
@@ -89,13 +77,7 @@
9078 e.preventDefault();
9179 return false;
9280 } );
93 - },
94 - 'msg': function() {
95 - if ( arguments.length ) {
96 - arguments[0] = $.articleFeedback.cfg.msgPrefix + arguments[0];
97 - }
98 - return mediaWiki.msg.apply( mediaWiki, arguments );
99 - },
 81+ }
10082 }
10183 };
10284

Status & tagging log