Open pawaclawczyk opened 10 years ago
Yaml configuration - SessionConfigurationFixer detects occurance of default_locale: pl
, probably it is fixable.
Twig templates - SessionLocaleTwigFixer replaces occurances of completa path, and add info about calls to locale
method. So I think it's done.
PHP templates - Not implemented.
getLocale()
method calls - SessionLocalePhpFixer adds info about existing calls like getLocale()
. Needs more discussion.
Locale management was moved from the Session class to the Request class.
Configuring the default locale
Before:
After:
Retrieving the locale from a Twig template
Before:
{{ app.request.session.locale }}
or{{ app.session.locale }}
After:
{{ app.request.locale }}
Retrieving the locale from a PHP template
Before:
$view['session']->getLocale()
After:
$view['request']->getLocale()
Retrieving the locale from PHP code
Before:
$session->getLocale()
After:
$request->getLocale()
Simulate old behavior
You can simulate that the locale for the user is still stored in the session by registering a listener that looks like the following if the parameter which handles the locale value in the request is
_locale
: