From: Bartosz Dziewoński Date: Fri, 9 May 2014 18:06:58 +0000 (+0200) Subject: Split messages for recent change legend and letter tooltips X-Git-Tag: 1.31.0-rc.0~15368 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=3886e4cc2125cf95345ee69d26bda5b3f1787d49;p=lhc%2Fweb%2Fwiklou.git Split messages for recent change legend and letter tooltips 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 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index be3f3c3eea..5b427509d5 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 } diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index f7c95d1024..ad1ee36a8d 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -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', diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 0d72a36b80..14b4b4b7d6 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1200,7 +1200,10 @@ "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": "(±123)", "rcnotefrom": "Below are the changes since $2 (up to $1 shown).", "rclistfrom": "Show new changes starting from $2, $3", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index d94214b8e6..c9aed64d01 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1362,7 +1362,10 @@ "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}}.",