When a Closure is passed as the $view parameter to RainLab\Translate\Classes\EventCoreRegistry::getLocalizedView(), the following error occurs:
Error: Object of class Closure could not be converted to string in EventCoreRegistry.php:344
This is due to a sprintf() call that assumes $view can be converted to a string:
sprintf('%s-%s', $view, $locale);
Closures cannot be cast to string, which causes the exception. A type check should be added to handle closures differently and avoid this fatal error.
I’m using a Laravel package that sends notifications via Laravel’s native notification system. One of the notifications uses a Closure as the view, which causes an exception inside the RainLab Translate plugin and prevents the notification from being sent.