class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterface, ChoiceMessageFormatterInterface

Methods

__construct($translator = null, IntlFormatterInterface $intlFormatter = null)

No description

string
format(string $message, string $locale, array $parameters = array())

Formats a localized message pattern with given arguments.

string
formatIntl(string $message, string $locale, array $parameters = array())

Formats a localized message using rules defined by ICU MessageFormat.

string
choiceFormat(string $message, int $number, string $locale, array $parameters = array()) deprecated

Formats a localized message pattern with given arguments.

Details

__construct($translator = null, IntlFormatterInterface $intlFormatter = null)

Parameters

$translator
IntlFormatterInterface $intlFormatter

string format(string $message, string $locale, array $parameters = array())

Formats a localized message pattern with given arguments.

Parameters

string $message The message (may also be an object that can be cast to string)
string $locale The message locale
array $parameters An array of parameters for the message

Return Value

string

string formatIntl(string $message, string $locale, array $parameters = array())

Formats a localized message using rules defined by ICU MessageFormat.

Parameters

string $message
string $locale
array $parameters

Return Value

string

string choiceFormat(string $message, int $number, string $locale, array $parameters = array()) deprecated

deprecated since Symfony 4.2, use format() with a %count% parameter instead

Formats a localized message pattern with given arguments.

Parameters

string $message The message (may also be an object that can be cast to string)
int $number The number to use to find the indice of the message
string $locale The message locale
array $parameters An array of parameters for the message

Return Value

string