3 namespace MediaWiki\Message
;
6 use Wikimedia\Message\IMessageFormatterFactory
;
7 use Wikimedia\Message\ITextFormatter
;
10 * The MediaWiki-specific implementation of IMessageFormatterFactory
12 class MessageFormatterFactory
implements IMessageFormatterFactory
{
18 private $textFormatters = [];
21 * Required parameters may be added to this function without deprecation.
22 * External callers should use MediaWikiServices::getMessageFormatterFactory().
24 * @param string $format which if the Message::FORMAT_* to use in the formatters.
27 public function __construct( string $format = Message
::FORMAT_TEXT
) {
28 $this->format
= $format;
34 public function getTextFormatter( $langCode ): ITextFormatter
{
35 if ( !isset( $this->textFormatters
[$langCode] ) ) {
36 $this->textFormatters
[$langCode] = new TextFormatter(
37 $langCode, new Converter(), $this->format
);
39 return $this->textFormatters
[$langCode];