MediaWiki master
MessageFormatterFactory.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Message;
4
7
12
14 private $format;
15
17 private $textFormatters = [];
18
26 public function __construct( string $format = Message::FORMAT_TEXT ) {
27 $this->format = $format;
28 }
29
33 public function getTextFormatter( $langCode ): ITextFormatter {
34 if ( !isset( $this->textFormatters[$langCode] ) ) {
35 $this->textFormatters[$langCode] = new TextFormatter(
36 $langCode, new Converter(), $this->format );
37 }
38 return $this->textFormatters[$langCode];
39 }
40}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
Converter between Message and MessageValue.
Definition Converter.php:17
The MediaWiki-specific implementation of IMessageFormatterFactory.
getTextFormatter( $langCode)
Get a text message formatter for a given language.ITextFormatter
__construct(string $format=Message::FORMAT_TEXT)
Required parameters may be added to this function without deprecation.
const FORMAT_TEXT
Transform {{..}} constructs but don't transform to HTML.
Definition Message.php:165
The MediaWiki-specific implementation of ITextFormatter.
A simple factory providing a message formatter for a given language code.