MediaWiki master
MessageFormatterFactory.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Message;
4
7
16 private string $format;
17 private array $textFormatters = [];
18
23 public function __construct( string $format = Message::FORMAT_TEXT ) {
24 $this->format = $format;
25 }
26
30 public function getTextFormatter( string $langCode ): ITextFormatter {
31 if ( !isset( $this->textFormatters[$langCode] ) ) {
32 $this->textFormatters[$langCode] = new TextFormatter(
33 $langCode, $this->format );
34 }
35 return $this->textFormatters[$langCode];
36 }
37}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
The MediaWiki-specific implementation of IMessageFormatterFactory.
getTextFormatter(string $langCode)
Get a text message formatter for a given language.ITextFormatter
__construct(string $format=Message::FORMAT_TEXT)
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.