MediaWiki REL1_39
MessageFormatterFactory.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Message;
4
5use Message;
8
13
15 private $format;
16
18 private $textFormatters = [];
19
27 public function __construct( string $format = Message::FORMAT_TEXT ) {
28 $this->format = $format;
29 }
30
34 public function getTextFormatter( $langCode ): ITextFormatter {
35 if ( !isset( $this->textFormatters[$langCode] ) ) {
36 $this->textFormatters[$langCode] = new TextFormatter(
37 $langCode, new Converter(), $this->format );
38 }
39 return $this->textFormatters[$langCode];
40 }
41}
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
Definition WebStart.php:82
Converter between Message and MessageValue.
Definition Converter.php:18
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.
The MediaWiki-specific implementation of ITextFormatter.
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:140
const FORMAT_TEXT
Transform {{..}} constructs but don't transform to HTML.
Definition Message.php:148
A simple factory providing a message formatter for a given language code.