lunetics/LocaleBundle — pull request #115 by EmmanuelVella (2014-07-15 11:08:42+00:00)
Title: Set request _locale attribute in locale listener

I'm working on a REST API, and I only use the ``browser guesser`` so the locale is determined by the ``Accept-Language`` header.

Asking for another locale than the default ``en`` one doesn't work, as symfony's ``LocaleListener`` is called just after, and use the request ``_locale`` attribute to set the request locale (see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php#L91)

**Bundle LocaleListener** (sets the request locale from guessed locale)
echo $request->getLocale() // returns 'fr'
echo $request->attributes->get('_locale') // returns 'en'

**Symfony LocaleListener** (sets the request locale from request ``_locale`` attribute)
echo $request->getLocale() // returns 'en'
echo $request->attributes->get('_locale') // returns 'en'

To fix this, this PR sets the request ``_locale`` attribute in locale listener.