class MessageTranslator implements TranslatorInterface

Class MessageTranslator.

Methods

__construct(ErrorCodeProviderInterface $provider)

MessageTranslator constructor.

addResource(array $items)

Add extra resources.

string
trans(string $id, array $parameters = [], string $domain = null, string $locale = null)

Translates the given message.

string
getLocale()

Returns the current locale.

Details

at line 40
__construct(ErrorCodeProviderInterface $provider)

MessageTranslator constructor.

Parameters

ErrorCodeProviderInterface $provider

at line 50
addResource(array $items)

Add extra resources.

Parameters

array $items

at line 67
string trans(string $id, array $parameters = [], string $domain = null, string $locale = null)

Translates the given message.

Parameters

string $id The message id (may also be an object that can be cast to string)
array $parameters An array of parameters for the message
string $domain The domain for the message or null to use the default
string $locale The locale or null to use the default

Return Value

string The translated string

Exceptions

InvalidArgumentException If the locale contains invalid characters

at line 77
string getLocale()

Returns the current locale.

Return Value

string The locale