translator icon indicating copy to clipboard operation
translator copied to clipboard

Callback to return custom string on MissingTranslationEvent

Open tomaszkane opened this issue 3 years ago • 1 comments

What steps will reproduce the problem?

$thisMessageIdNotExist = 'xyz';
echo $translator->translate($thisMessageIdIsNotExist);

What do you get?

xyz

What do you want to get?

Oh no, "xyz" is not translated yet!

When event MissingTranslationEvent was triggered I want to return result of my callback not messageId string or fallbackLocale result.

Telegram conversation

Additional info

Q A
Version 1.0.2
PHP version 8.0
Operating system KDE Neon

tomaszkane avatar Sep 07 '22 20:09 tomaszkane

Could be achieved by using result of dispatch() method that returns modified event with the message to format.

samdark avatar Sep 07 '22 21:09 samdark