\Cake\I18n\FormatterIcuFormatter

A formatter that will interpolate variables using the MessageFormatter class

Summary

Methods
Properties
Constants
format()
No public properties found
No constants found
_formatMessage()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

format()

format(string  $locale, string|array  $message, array  $vars) : string

Returns a string with all passed variables interpolated into the original message. Variables are interpolated using the MessageFormatter class.

Parameters

string $locale

The locale in which the message is presented.

string|array $message

The message to be translated

array $vars

The list of values to interpolate in the message

Throws

\Aura\Intl\Exception\CannotFormat
\Aura\Intl\Exception\CannotInstantiateFormatter

Returns

string —

The formatted message

_formatMessage()

_formatMessage(string  $locale, string|array  $message, array  $vars) : string

Does the actual formatting using the MessageFormatter class

Parameters

string $locale

The locale in which the message is presented.

string|array $message

The message to be translated

array $vars

The list of values to interpolate in the message

Throws

\Aura\Intl\Exception\CannotInstantiateFormatter

if any error occurred while parsing the message

\Aura\Intl\Exception\CannotFormat

If any error related to the passed variables is found

Returns

string —

The formatted message