r92783 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92782‎ | r92783 | r92784 >
Date:19:50, 21 July 2011
Author:werdna
Status:deferred (Comments)
Tags:todo 
Comment:
MoodBar: move configuration into MoodBar.php so it can be overridden, and add content for "what is this?"
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.hooks.php (modified) (history)
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/MoodBar.php (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -32,7 +32,10 @@
3333 'moodbar-what-label' => 'What is this?',
3434 'moodbar-what-expanded' => '▶', // Ignore, do not translate. ▼
3535 'moodbar-what-collapsed' => '▼', // Ignore, do not translate. ▶
36 - 'moodbar-what-content' => '--- @todo ---',
 36+ 'moodbar-what-content' => 'This feature is designed to help the Wikipedia community understand the experience of people editing Wikipedia.
 37+For more information, please visit the $1.',
 38+ 'moodbar-what-link' => 'feature page',
 39+ 'moodbar-disable' => "I'm not interested. Please disable this feature.",
3740 'moodbar-form-title' => 'Because...',
3841 'moodbar-form-note' => '140 character maximum',
3942 'moodbar-form-note-dynamic' => '$1 characters remaining',
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js
@@ -27,7 +27,7 @@
2828 <span class="mw-moodBar-overlayWhatTrigger"></span>\
2929 <span class="mw-moodBar-overlayWhatLabel"><html:msg key="moodbar-what-label" /></span>\
3030 </a>\
31 - <div class="mw-moodBar-overlayWhatContent"><html:msg key="moodbar-what-content" /></div>\
 31+ <div class="mw-moodBar-overlayWhatContent"></div>\
3232 </span>\
3333 </div>',
3434 type: '\
@@ -95,7 +95,7 @@
9696 .get( 0 )
9797 );
9898 } );
99 - return elems;ß
 99+ return elems;
100100 } )
101101 .hover( function() {
102102 $( this ).addClass( 'mw-moodBar-types-hover' );
@@ -124,6 +124,26 @@
125125 } )
126126 } )
127127 .end()
 128+ .find( '.mw-moodBar-overlayWhatContent' )
 129+ .html(
 130+ function() {
 131+ var message, linkMessage, link;
 132+
 133+ message = mw.message('moodbar-what-content');
 134+ linkMessage = mw.msg('moodbar-what-link');
 135+ link = mw.html.element('a',
 136+ {
 137+ 'href' : mb.conf.infoUrl,
 138+ 'title' : linkMessage
 139+ }, linkMessage );
 140+
 141+ message = message.escaped();
 142+ message = message.replace( /\$1/, link );
 143+
 144+ return message;
 145+ }
 146+ )
 147+ .end()
128148 // Submit
129149 .find( '.mw-moodBar-formSubmit' )
130150 .val( mw.msg( 'moodbar-form-submit' ) )
Index: trunk/extensions/MoodBar/MoodBar.php
@@ -77,6 +77,7 @@
7878 'moodbar-what-expanded',
7979 'moodbar-what-collapsed',
8080 'moodbar-what-content',
 81+ 'moodbar-what-link',
8182 'moodbar-form-title',
8283 'moodbar-form-note',
8384 'moodbar-form-note-dynamic',
@@ -104,3 +105,19 @@
105106 /** Configuration **/
106107 /** The registration time after which users will be shown the MoodBar **/
107108 $wgMoodBarCutoffTime = null;
 109+
 110+/** MoodBar configuration settings **/
 111+$wgMoodBarConfig = array(
 112+ 'bucketConfig' =>
 113+ array(
 114+ 'buckets' =>
 115+ array(
 116+ 'feedback' => 80,
 117+ 'using' => 10,
 118+ 'share' => 10,
 119+ ),
 120+ 'version' => 1,
 121+ 'expires' => 30,
 122+ ),
 123+ 'infoUrl' => 'http://www.mediawiki.org/wiki/MoodBar',
 124+);
Index: trunk/extensions/MoodBar/MoodBar.hooks.php
@@ -49,22 +49,11 @@
5050 * ResourceLoaderGetConfigVars hook
5151 */
5252 public static function resourceLoaderGetConfigVars( &$vars ) {
53 - global $wgUser;
 53+ global $wgUser, $wgMoodBarConfig;
5454 $vars['mbConfig'] = array(
5555 'validTypes' => MBFeedbackItem::getValidTypes(),
5656 'userBuckets' => MoodBarHooks::getUserBuckets( $wgUser ),
57 - 'bucketConfig' =>
58 - array(
59 - 'buckets' =>
60 - array(
61 - 'feedback' => 80,
62 - 'using' => 10,
63 - 'share' => 10,
64 - ),
65 - 'version' => 1,
66 - 'expires' => 30,
67 - ),
68 - );
 57+ ) + $wgMoodBarConfig;
6958 return true;
7059 }
7160

Follow-up revisions

RevisionCommit summaryAuthorDate
r92849Followup r92783/r92823: update ignore messages for translatewiki.net.raymond06:45, 22 July 2011

Comments

#Comment by Siebrand (talk | contribs)   09:40, 6 September 2011

+ 'moodbar-what-content' => 'This feature is designed to help the Wikipedia community understand the experience of people editing Wikipedia. +For more information, please visit the $1.',

We got a request at translatewiki to improve i18n for this message by adding the link into the message itself. Is it possible to join the two message and make it something like:

This feature is designed to help the Wikipedia community understand the experience of people editing Wikipedia. For more information, please visit the [$1 feature page].

The current type of patchwork should really be avoided (!)

#Comment by Werdna (talk | contribs)   09:41, 6 September 2011

It can't be done that way because of limitations in the localisation capabilities of JavaScript. Unfortunately, it will need to stay that way until the requisite functionality is developed for messages to be parsed in JS.

#Comment by Siebrand (talk | contribs)   10:16, 6 September 2011
  • sigh*
#Comment by Siebrand (talk | contribs)   10:18, 6 September 2011

Same for 'moodbar-privacy' and 'moodbar-privacy-link from r92906. Adding it here to reduce the number of 'todo'-ed revs.

#Comment by Werdna (talk | contribs)   10:19, 6 September 2011

The 'todo' tag is going to stay on for several months if you want to keep it on until those messages are converted to have the links embedded.

#Comment by Siebrand (talk | contribs)   10:29, 6 September 2011

Well, the current feeling I'm getting is that no one thinks this is important enough to FIXME and actually get it fixed, so todo tagging is the only way to get some indication something is wrong here, right?

Status & tagging log