From ff36ecab6746c76bc9494322cfd5f09423aaa80d Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Tue, 27 Sep 2016 01:23:21 +0100 Subject: [PATCH] EditPage: Allow language of copyright warning to be specified This avoids global state, and is necessary in places where the global user language cannot be used, such as load.php. Bug: T146686 Change-Id: I80a813a76b551643b68430e6a0ab553b2e1dfb11 --- includes/EditPage.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 406673dee2..9116d4f132 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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 "
\n" . - call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title )->$format() . "\n
"; + $msg->$format() . "\n"; } /** -- 2.20.1