From dc91b4dcb5d7651e96fc1b86a5c39be75541dcb2 Mon Sep 17 00:00:00 2001 From: Platonides Date: Fri, 3 Dec 2010 00:21:50 +0000 Subject: [PATCH] Make $wgForceUIMsgAsContentMsg work a bit different for the messages we place in the upload form. This is specially intended for commons, such that it no longer needs a bot changing the headers after each upload. See http://commons.wikimedia.org/w/index.php?title=Commons%3AVillage_pump&action=historysubmit&diff=46619490&oldid=46619456#Uploading_a_new_file.2C_and_proceeding_updates --- includes/specials/SpecialUpload.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 7a7a808c56..37db906651 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -486,21 +486,35 @@ class SpecialUpload extends SpecialPage { * Get the initial image page text based on a comment and optional file status information */ public static function getInitialPageText( $comment = '', $license = '', $copyStatus = '', $source = '' ) { - global $wgUseCopyrightUpload; + global $wgUseCopyrightUpload, $wgForceUIMsgAsContentMsg; + $wgForceUIMsgAsContentMsg = (array) $wgForceUIMsgAsContentMsg; + + /* These messages are transcluded into the actual text of the description page. + * Thus, forcing them as content messages makes the upload to produce an int: template + * instead of hardcoding it there in the uploader language. + */ + foreach( array( 'license-header', 'filedesc', 'filestatus', 'filesource' ) as $msgName ) { + if ( in_array( $msgName, $wgForceUIMsgAsContentMsg ) ) { + $msg[$msgName] = "{{int:$msgName}}"; + } else { + $msg[$msgName] = wfMsgForContent( $msgName ); + } + } + if ( $wgUseCopyrightUpload ) { $licensetxt = ''; if ( $license != '' ) { - $licensetxt = '== ' . wfMsgForContent( 'license-header' ) . " ==\n" . '{{' . $license . '}}' . "\n"; + $licensetxt = '== ' . $msg[ 'license-header' ] . " ==\n" . '{{' . $license . '}}' . "\n"; } - $pageText = '== ' . wfMsgForContent( 'filedesc' ) . " ==\n" . $comment . "\n" . - '== ' . wfMsgForContent( 'filestatus' ) . " ==\n" . $copyStatus . "\n" . + $pageText = '== ' . $msg[ 'filedesc' ] . " ==\n" . $comment . "\n" . + '== ' . $msg[ 'filestatus' ] . " ==\n" . $copyStatus . "\n" . "$licensetxt" . - '== ' . wfMsgForContent( 'filesource' ) . " ==\n" . $source; + '== ' . $msg[ 'filesource' ] . " ==\n" . $source; } else { if ( $license != '' ) { - $filedesc = $comment == '' ? '' : '== ' . wfMsgForContent( 'filedesc' ) . " ==\n" . $comment . "\n"; + $filedesc = $comment == '' ? '' : '== ' . $msg[ 'filedesc' ] . " ==\n" . $comment . "\n"; $pageText = $filedesc . - '== ' . wfMsgForContent( 'license-header' ) . " ==\n" . '{{' . $license . '}}' . "\n"; + '== ' . $msg[ 'license-header' ] . " ==\n" . '{{' . $license . '}}' . "\n"; } else { $pageText = $comment; } -- 2.20.1