*
* @file
*/
+use MediaWiki\MediaWikiServices;
/**
* CommentStoreComment represents a comment stored by CommentStore. The fields
public function __construct( $id, $text, Message $message = null, array $data = null ) {
$this->id = $id;
$this->text = $text;
- $this->message = $message ?: new RawMessage( '$1', [ $text ] );
+ $this->message = $message ?: new RawMessage( '$1', [ Message::plaintextParam( $text ) ] );
$this->data = $data;
}
* @return CommentStoreComment
*/
public static function newUnsavedComment( $comment, array $data = null ) {
- global $wgContLang;
-
if ( $comment instanceof CommentStoreComment ) {
return $comment;
}
if ( $comment instanceof Message ) {
$message = clone $comment;
- $text = $message->inLanguage( $wgContLang ) // Avoid $wgForceUIMsgAsContentMsg
+ // Avoid $wgForceUIMsgAsContentMsg
+ $text = $message->inLanguage( MediaWikiServices::getInstance()->getContentLanguage() )
->setInterfaceMessageFlag( true )
->text();
return new CommentStoreComment( null, $text, $message, $data );