wiki.techinc.nl/includes/Message/MessageFormatterFactory.php
Brad Jorsch 3f9f2f1ca8 MediaWiki\Message: Extract Message↔MessageValue conversion from TextFormatter
The Action API is going to need to convert between the two at various
boundaries where it receives a Status from business logic.

Also when we make HtmlFormatter and the like, that'll initially need the
same conversion logic too.

Change-Id: Id5b216b033718f3ef38bfd4be1715218ee07bb93
2019-11-26 08:58:05 +00:00

29 lines
780 B
PHP

<?php
namespace MediaWiki\Message;
use Wikimedia\Message\IMessageFormatterFactory;
use Wikimedia\Message\ITextFormatter;
/**
* The MediaWiki-specific implementation of IMessageFormatterFactory
*/
class MessageFormatterFactory implements IMessageFormatterFactory {
private $textFormatters = [];
/**
* Required parameters may be added to this function without deprecation.
* External callers should use MediaWikiServices::getMessageFormatterFactory().
*
* @internal
*/
public function __construct() {
}
public function getTextFormatter( $langCode ): ITextFormatter {
if ( !isset( $this->textFormatters[$langCode] ) ) {
$this->textFormatters[$langCode] = new TextFormatter( $langCode, new Converter() );
}
return $this->textFormatters[$langCode];
}
}