lunetics/LocaleBundle — pull request #39 by lunetics (2012-10-26 03:39:29+00:00)
Title: Update to use Events, small changes

So, i cleaned up a little bit more, updated some docs and the configuration

the `set_cookie_on_detection` and `set_cookie_on_switch` were deleted and replaced by `set_cookie_on_change`, since the listener now uses an event.

It didn't really make sense to distinguish from detection and switch, since a switch is the same as detection (by now) with using the event dispatcher.

Not sure yet if it makes any sense to build a listener for request locales, since we can set the locales 99% directly into the request.

Basically the LocaleListeners dispatches an FilterLocaleSwitchEvent when the user uses the `session` or `cookie` guesser. The event only dispatches then and checks for changes. (No need for it in the LocaleController anymore).

Also it's now easy possible to set userlocales for example:

``` php
$locale = $user->getLocale();
$localeSwitchEvent = new FilterLocaleSwitchEvent($locale);
$this->dispatcher->dispatch(LocaleBundleEvents::onLocaleChange, $localeSwitchEvent);
```