Merge "EditPage: Allow language of copyright warning to be specified"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 27 Sep 2016 03:59:33 +0000 (03:59 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 27 Sep 2016 03:59:33 +0000 (03:59 +0000)
includes/EditPage.php

index 7f01643..f449283 100644 (file)
@@ -3496,7 +3496,7 @@ HTML
         * @param string $format Output format, valid values are any function of a Message object
         * @return string
         */
-       public static function getCopyrightWarning( $title, $format = 'plain' ) {
+       public static function getCopyrightWarning( $title, $format = 'plain', $langcode = null ) {
                global $wgRightsText;
                if ( $wgRightsText ) {
                        $copywarnMsg = [ 'copyrightwarning',
@@ -3509,8 +3509,12 @@ HTML
                // Allow for site and per-namespace customization of contribution/copyright notice.
                Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg ] );
 
+               $msg = call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title );
+               if ( $langcode ) {
+                       $msg->inLanguage( $langcode );
+               }
                return "<div id=\"editpage-copywarn\">\n" .
-                       call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title )->$format() . "\n</div>";
+                       $msg->$format() . "\n</div>";
        }
 
        /**