mirror of
https://github.com/Respect/Validation.git
synced 2024-06-26 17:20:16 +02:00
5c0bd3a5da
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
586 B
586 B
Message translation
You're also able to translate your message to another language with Validation.
The only thing one must do is to define the param translator
as a callable that
will handle the translation overwriting the default factory:
Factory::setDefaultInstance(
(new Factory())->withTranslator('gettext')
);
The example above uses gettext()
but you can use any other callable value, like
[$translator, 'trans']
or you_custom_function()
.
After that, if you call getMessage()
, getMessages()
, or getFullMessage()
,
the message will be translated.