Use wfMsg()'s parameters
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 15 Nov 2003 14:32:58 +0000 (14:32 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 15 Nov 2003 14:32:58 +0000 (14:32 +0000)
includes/GlobalFunctions.php
includes/OutputPage.php

index 0de9ac3..9efda15 100644 (file)
@@ -540,10 +540,9 @@ function wfRecordUpload( $name, $oldver, $size, $desc )
        }
 
        $log = new LogPage( wfMsg( "uploadlogpage" ), wfMsg( "uploadlogpagetext" ) );
-       $da = str_replace( "$1", "[[:" . $wgLang->getNsText(
-         Namespace::getImage() ) . ":{$name}|{$name}]]",
-         wfMsg( "uploadedimage" ) );
-       $ta = str_replace( "$1", $name, wfMsg( "uploadedimage" ) );
+       $da = wfMsg( "uploadedimage", "[[:" . $wgLang->getNsText(
+         Namespace::getImage() ) . ":{$name}|{$name}]]" );
+       $ta = wfMsg( "uploadedimage", $name );
        $log->addEntry( $da, $desc, $ta );
 }
 
@@ -552,24 +551,19 @@ function wfRecordUpload( $name, $oldver, $size, $desc )
 
 function wfShowingResults( $offset, $limit )
 {
-       $top = str_replace( "$1", $limit, wfMsg( "showingresults" ) );
-       $top = str_replace( "$2", $offset+1, $top );
-       return $top;
+       return wfMsg( "showingresults", $limit, $offset+1 );
 }
 
 function wfShowingResultsNum( $offset, $limit, $num )
 {
-       $top = str_replace( "$1", $limit, wfMsg( "showingresultsnum" ) );
-       $top = str_replace( "$2", $offset+1, $top );
-       $top = str_replace( "$3", $num, $top );
-       return $top;
+       return wfMsg( "showingresultsnum", $limit, $offset+1, $num );
 }
 
 function wfViewPrevNext( $offset, $limit, $link, $query = "" )
 {
        global $wgUser;
-       $prev = str_replace( "$1", $limit, wfMsg( "prevn" ) );
-       $next = str_replace( "$1", $limit, wfMsg( "nextn" ) );
+       $prev = wfMsg( "prevn", $limit );
+       $next = wfMsg( "nextn", $limit );
 
        $sk = $wgUser->getSkin();
        if ( 0 != $offset ) {
@@ -591,10 +585,7 @@ function wfViewPrevNext( $offset, $limit, $link, $query = "" )
          wfNumLink( $offset, 250, $link, $query ) . " | " .
          wfNumLink( $offset, 500, $link, $query );
 
-       $sl = str_replace( "$1", $plink, wfMsg( "viewprevnext" ) );
-       $sl = str_replace( "$2", $nlink, $sl );
-       $sl = str_replace( "$3", $nums, $sl );
-       return $sl;
+       return wfMsg( "viewprevnext", $plink, $nlink, $nums );
 }
 
 function wfNumLink( $offset, $limit, $link, $query = "" )
index c20c1d7..1bf0923 100644 (file)
@@ -368,8 +368,7 @@ class OutputPage {
 
                $sk = $wgUser->getSkin();
                $ap = $sk->makeKnownLink( wfMsg( "administrators" ), "" );      
-               $text = str_replace( "$1", $ap, wfMsg( "sysoptext" ) );
-               $this->addHTML( $text );
+               $this->addHTML( wfMsg( "sysoptext", $ap ) );
                $this->returnToMain();
        }
 
@@ -385,8 +384,7 @@ class OutputPage {
 
                $sk = $wgUser->getSkin();
                $ap = $sk->makeKnownLink( wfMsg( "administrators" ), "" );      
-               $text = str_replace( "$1", $ap, wfMsg( "developertext" ) );
-               $this->addHTML( $text );
+               $this->addHTML( wfMsg( "developertext", $ap ) );
                $this->returnToMain();
        }
 
@@ -401,7 +399,7 @@ class OutputPage {
                if ( $wgCommandLineMode ) {
                        $msg = wfMsgNoDB( "dberrortextcl" );
                } else {
-                       $msg = wfMsgNoDB( "dberrortextcl" );
+                       $msg = wfMsgNoDB( "dberrortext" );
                }
 
                $msg = str_replace( "$1", htmlspecialchars( wfLastDBquery() ), $msg );
@@ -463,35 +461,27 @@ class OutputPage {
 
        function unexpectedValueError( $name, $val )
        {
-               $msg = str_replace( "$1", $name, wfMsg( "unexpected" ) );
-               $msg = str_replace( "$2", $val, $msg );
-               $this->fatalError( $msg );
+               $this->fatalError( wfMsg( "unexpected", $name, $val ) );
        }
 
        function fileCopyError( $old, $new )
        {
-               $msg = str_replace( "$1", $old, wfMsg( "filecopyerror" ) );
-               $msg = str_replace( "$2", $new, $msg );
-               $this->fatalError( $msg );
+               $this->fatalError( wfMsg( "filecopyerror", $old, $new ) );
        }
 
        function fileRenameError( $old, $new )
        {
-               $msg = str_replace( "$1", $old, wfMsg( "filerenameerror" ) );
-               $msg = str_replace( "$2", $new, $msg );
-               $this->fatalError( $msg );
+               $this->fatalError( wfMsg( "filerenameerror", $old, $new ) );
        }
 
        function fileDeleteError( $name )
        {
-               $msg = str_replace( "$1", $name, wfMsg( "filedeleteerror" ) );
-               $this->fatalError( $msg );
+               $this->fatalError( wfMsg( "filedeleteerror", $name ) );
        }
 
        function fileNotFoundError( $name )
        {
-               $msg = str_replace( "$1", $name, wfMsg( "filenotfound" ) );
-               $this->fatalError( $msg );
+               $this->fatalError( wfMsg( "filenotfound", $name ) );
        }
 
        function returnToMain( $auto = true )
@@ -504,7 +494,7 @@ class OutputPage {
                }
                $link = $sk->makeKnownLink( $returnto, "" );
 
-               $r = str_replace( "$1", $link, wfMsg( "returnto" ) );
+               $r = wfMsg( "returnto", $link );
                if ( $auto ) {
                        $wgOut->addMeta( "http:Refresh", "10;url=" .
                          wfLocalUrlE( wfUrlencode( $returnto ) ) );
@@ -560,7 +550,7 @@ class OutputPage {
                if ( count ( $articles ) > 0 )
                {
                        asort ( $articles ) ;
-                       $h = str_replace ( "$1" , $ti[1] , wfMsg("category_header") ) ;
+                       $h =  wfMsg( "category_header", $ti[1] );
                        $r .= "<h2>{$h}</h2>\n" ;
                        $r .= implode ( ", " , $articles ) ;
                }