Merge "Add IContextSource as parameter to ChangeTags::formatSummaryRow"
[lhc/web/wiklou.git] / includes / changetags / ChangeTags.php
index a8c9f7b..305eeab 100644 (file)
@@ -35,16 +35,20 @@ class ChangeTags {
         * @param string $tags Comma-separated list of tags
         * @param string $page A label for the type of action which is being displayed,
         *   for example: 'history', 'contributions' or 'newpages'
+        * @param IContextSource|null $context
+        * @note Even though it takes null as a valid argument, an IContextSource is preferred
+        *       in a new code, as the null value is subject to change in the future
         * @return array Array with two items: (html, classes)
         *   - html: String: HTML for displaying the tags (empty string when param $tags is empty)
         *   - classes: Array of strings: CSS classes used in the generated html, one class for each tag
         */
-       public static function formatSummaryRow( $tags, $page ) {
-               global $wgLang;
-
+       public static function formatSummaryRow( $tags, $page, IContextSource $context = null ) {
                if ( !$tags ) {
                        return array( '', array() );
                }
+               if ( !$context ) {
+                       $context = RequestContext::getMain();
+               }
 
                $classes = array();
 
@@ -71,9 +75,9 @@ class ChangeTags {
                        return array( '', array() );
                }
 
-               $markers = wfMessage( 'tag-list-wrapper' )
+               $markers = $context->msg( 'tag-list-wrapper' )
                        ->numParams( count( $displayTags ) )
-                       ->rawParams( $wgLang->commaList( $displayTags ) )
+                       ->rawParams( $context->getLanguage()->commaList( $displayTags ) )
                        ->parse();
                $markers = Xml::tags( 'span', array( 'class' => 'mw-tag-markers' ), $markers );