laravel-doctrine / extensions

Extensions integration for Doctrine2 and Laravel
http://laraveldoctrine.org/
MIT License
48 stars 24 forks source link

Update TranslatableListener on Laravel's locale.changed event #27

Closed guiwoda closed 8 years ago

guiwoda commented 8 years ago

The TranslatableListener is storing the current locale when the extension is subscribed, and that's usually on ServiceProvider::register or boot. If the application changes its locale somewhere along the road (maybe middleware, or even in a late SP), the extension won't detect that change.

This PR hooks to Laravel's "locale.changed" event to update the listener with the new locale setting.