(bug 13012) Use content messages for block options when generating the rc entry
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 6 Mar 2008 14:45:27 +0000 (14:45 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 6 Mar 2008 14:45:27 +0000 (14:45 +0000)
RELEASE-NOTES
includes/LogPage.php

index 6de5a75..8a29f8f 100644 (file)
@@ -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 ===
 
index 7c89df7..df6b9da 100644 (file)
@@ -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];