From a54911d073bc58441ed159fdbe30ba174d01f7f8 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 6 Mar 2008 14:45:27 +0000 Subject: [PATCH] (bug 13012) Use content messages for block options when generating the rc entry --- RELEASE-NOTES | 3 ++- includes/LogPage.php | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6de5a7565c..8a29f8f357 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -68,7 +68,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * maintenance/refreshLinks.php did not fix page_id 1 with the --new-only option * (bug 13110) Don't show "Permission error" page if the edit is already rolled back when using rollback - +* (bug 13012) Use content messages for block options when generating the + recentchages entry === API changes in 1.13 === diff --git a/includes/LogPage.php b/includes/LogPage.php index 7c89df7682..df6b9dad18 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -211,7 +211,7 @@ class LogPage { $params[1] = $wgContLang->translateBlockExpiry( $params[1] ); } $params[2] = isset( $params[2] ) - ? self::formatBlockFlags( $params[2] ) + ? self::formatBlockFlags( $params[2], is_null( $skin ) ) : ''; } $rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin ); @@ -275,13 +275,15 @@ class LogPage { * into a more readable (and translated) form * * @param $flags Flags to format + * @param $forContent Whetever to localize the message depending of the user + * language * @return string */ - public static function formatBlockFlags( $flags ) { + public static function formatBlockFlags( $flags, $forContent = false ) { $flags = explode( ',', trim( $flags ) ); if( count( $flags ) > 0 ) { for( $i = 0; $i < count( $flags ); $i++ ) - $flags[$i] = self::formatBlockFlag( $flags[$i] ); + $flags[$i] = self::formatBlockFlag( $flags[$i], $forContent ); return '(' . implode( ', ', $flags ) . ')'; } else { return ''; @@ -292,13 +294,18 @@ class LogPage { * Translate a block log flag if possible * * @param $flag Flag to translate + * @param $forContent Whetever to localize the message depending of the user + * language * @return string */ - public static function formatBlockFlag( $flag ) { + public static function formatBlockFlag( $flag, $forContent = false ) { static $messages = array(); if( !isset( $messages[$flag] ) ) { $k = 'block-log-flags-' . $flag; - $msg = wfMsg( $k ); + if( $forContent ) + $msg = wfMsgForContent( $k ); + else + $msg = wfMsg( $k ); $messages[$flag] = htmlspecialchars( wfEmptyMsg( $k, $msg ) ? $flag : $msg ); } return $messages[$flag]; -- 2.20.1