Split messages for recent change legend and letter tooltips
authorBartosz Dziewoński <matma.rex@gmail.com>
Fri, 9 May 2014 18:06:58 +0000 (20:06 +0200)
committerRaimond Spekking <raimond.spekking@gmail.com>
Mon, 16 Jun 2014 06:47:53 +0000 (06:47 +0000)
This makes it possible to use formatting in the legend ones
(e.g. links to help pages) and to use different wording
(the one for tooltips is sometimes too verbose for the legend).

Documented the format of $wgRecentChangesFlags better.

The default text in not modified in this change.

Bug: 58715
Bug: 60235
Change-Id: Ie9872c8fb3e43620877300ee8536bb5ddee5ab46

includes/DefaultSettings.php
includes/specialpage/ChangesListSpecialPage.php
languages/i18n/en.json
languages/i18n/qqq.json

index be3f3c3..5b42750 100644 (file)
@@ -5772,24 +5772,42 @@ $wgUnwatchedPageThreshold = false;
  * To register a new one:
  * @code
  * $wgRecentChangesFlags['flag'] => array(
+ *   // message for the letter displayed next to rows on changes lists
  *   'letter' => 'letter-msg',
- *   'title' => 'tooltip-msg'
+ *   // message for the tooltip of the letter
+ *   'title' => 'tooltip-msg',
+ *   // optional (defaults to 'tooltip-msg'), message to use in the legend box
+ *   'legend' => 'legend-msg',
+ *   // optional (defaults to 'flag'), CSS class to put on changes lists rows
+ *   'class' => 'css-class',
  * );
  * @endcode
  *
- * Optional 'class' allows to set a css class different than the flag name.
- *
  * @since 1.22
  */
 $wgRecentChangesFlags = array(
-       'newpage' => array( 'letter' => 'newpageletter',
-               'title' => 'recentchanges-label-newpage' ),
-       'minor' => array( 'letter' => 'minoreditletter',
-               'title' => 'recentchanges-label-minor', 'class' => 'minoredit' ),
-       'bot' => array( 'letter' => 'boteditletter',
-               'title' => 'recentchanges-label-bot', 'class' => 'botedit' ),
-       'unpatrolled' => array( 'letter' => 'unpatrolledletter',
-               'title' => 'recentchanges-label-unpatrolled' ),
+       'newpage' => array(
+               'letter' => 'newpageletter',
+               'title' => 'recentchanges-label-newpage',
+               'legend' => 'recentchanges-legend-newpage',
+       ),
+       'minor' => array(
+               'letter' => 'minoreditletter',
+               'title' => 'recentchanges-label-minor',
+               'legend' => 'recentchanges-legend-minor',
+               'class' => 'minoredit',
+       ),
+       'bot' => array(
+               'letter' => 'boteditletter',
+               'title' => 'recentchanges-label-bot',
+               'legend' => 'recentchanges-legend-bot',
+               'class' => 'botedit',
+       ),
+       'unpatrolled' => array(
+               'letter' => 'unpatrolledletter',
+               'title' => 'recentchanges-label-unpatrolled',
+               'legend' => 'recentchanges-legend-unpatrolled',
+       ),
 );
 
 /** @} */ # end RC/watchlist }
index f7c95d1..ad1ee36 100644 (file)
@@ -412,23 +412,16 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                        unset( $legendItems['unpatrolled'] );
                }
                foreach ( $legendItems as $key => $item ) { # generate items of the legend
-                       $label = $item['title'];
+                       $label = isset( $item['legend'] ) ? $item['legend'] : $item['title'];
                        $letter = $item['letter'];
                        $cssClass = isset( $item['class'] ) ? $item['class'] : $key;
 
                        $legend .= Html::element( 'dt',
                                array( 'class' => $cssClass ), $context->msg( $letter )->text()
+                       ) . "\n" .
+                       Html::rawElement( 'dd', array(),
+                               $context->msg( $label )->parse()
                        ) . "\n";
-                       if ( $key === 'newpage' ) {
-                               $legend .= Html::openElement( 'dd' );
-                               $legend .= $context->msg( $label )->escaped();
-                               $legend .= ' ' . $context->msg( 'recentchanges-legend-newpage' )->parse();
-                               $legend .= Html::closeElement( 'dd' ) . "\n";
-                       } else {
-                               $legend .= Html::element( 'dd', array(),
-                                       $context->msg( $label )->text()
-                               ) . "\n";
-                       }
                }
                # (+-123)
                $legend .= Html::rawElement( 'dt',
index 0d72a36..14b4b4b 100644 (file)
        "recentchanges-label-unpatrolled": "This edit has not yet been patrolled",
        "recentchanges-label-plusminus": "The page size changed by this number of bytes",
        "recentchanges-legend-heading": "'''Legend:'''",
-       "recentchanges-legend-newpage": "(also see [[Special:NewPages|list of new pages]])",
+       "recentchanges-legend-newpage": "{{int:recentchanges-label-newpage}} (also see [[Special:NewPages|list of new pages]])",
+       "recentchanges-legend-minor": "{{int:recentchanges-label-minor}}",
+       "recentchanges-legend-bot": "{{int:recentchanges-label-bot}}",
+       "recentchanges-legend-unpatrolled": "{{int:recentchanges-label-unpatrolled}}",
        "recentchanges-legend-plusminus": "(<em>±123</em>)",
        "rcnotefrom": "Below are the changes since <strong>$2</strong> (up to <strong>$1</strong> shown).",
        "rclistfrom": "Show new changes starting from $2, $3",
index d94214b..c9aed64 100644 (file)
        "recentchanges-label-unpatrolled": "Tooltip for {{msg-mw|unpatrolledletter}}",
        "recentchanges-label-plusminus": "Legend item for plus/minus.\n\nPreceded by legend example {{msg-mw|Recentchanges-legend-plusminus}}.",
        "recentchanges-legend-heading": "Used as a heading for legend box on [[Special:RecentChanges]] and [[Special:Watchlist]].\n{{Identical|Legend}}",
-       "recentchanges-legend-newpage": "Used as legend in [[Special:RecentChanges]]. Preceded by {{msg-mw|Recentchanges-label-newpage}}.",
+       "recentchanges-legend-newpage": "Used as legend on [[Special:RecentChanges]] and [[Special:Watchlist]].",
+       "recentchanges-legend-minor": "Used as legend on [[Special:RecentChanges]] and [[Special:Watchlist]].",
+       "recentchanges-legend-bot": "Used as legend on [[Special:RecentChanges]] and [[Special:Watchlist]].",
+       "recentchanges-legend-unpatrolled": "Used as legend on [[Special:RecentChanges]] and [[Special:Watchlist]].",
        "recentchanges-legend-plusminus": "{{optional}}\nA plus/minus sign with a number for the legend.",
        "rcnotefrom": "This message is displayed at [[Special:RecentChanges]] when viewing recentchanges from some specific time.\n\nThe corresponding message is {{msg-mw|Rclistfrom}} (split into date and time).\n\nParameters:\n* $1 - the maximum number of changes that are displayed\n* $2 - a date and time\n* $3 - (Optional) a date\n* $4 - (Optional) a time",
        "rclistfrom": "Used on [[Special:RecentChanges]]. Parameters:\n* $1 - (Currently not use) date and time. The date and the time adds to the rclistfrom description.\n* $2 - time. The time adds to the rclistfrom link description (with split of date and time).\n* $3 - date. The date adds to the rclistfrom link description (with split of date and time).\n\nThe corresponding message is {{msg-mw|Rcnotefrom}}.",