BaseTemplate: Make getMsg() calling pattern more like wfMessage()
authorKunal Mehta <legoktm@member.fsf.org>
Fri, 14 Oct 2016 01:44:42 +0000 (18:44 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Fri, 14 Oct 2016 01:44:42 +0000 (18:44 -0700)
wfMessage() and IContextSource::msg() allow you to pass parameters to
the message in the initial function call, which is often more convenient
for developers. Support that in BaseTemplate::getMsg() too for
standardization.

Change-Id: I2488234f431be5bab00ca4366d864c84d7ff9e03

includes/skins/BaseTemplate.php

index 87865df..6ea8b89 100644 (file)
@@ -29,10 +29,11 @@ abstract class BaseTemplate extends QuickTemplate {
         * Get a Message object with its context set
         *
         * @param string $name Message name
+        * @param ... $params Message params
         * @return Message
         */
-       public function getMsg( $name ) {
-               return $this->getSkin()->msg( $name );
+       public function getMsg( $name /* ... */ ) {
+               return call_user_func_array( [ $this->getSkin(), 'msg' ], func_get_args() );
        }
 
        function msg( $str ) {