summaryrefslogtreecommitdiffstats
path: root/Http/HttpUtils.php
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2011-10-05 11:09:51 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2011-10-08 18:34:49 +0200
commitd18bf9e278ba86857c9696775c31b0ee03be1cfd (patch)
treead4094c71b1e05ab14661006645e13da356eafb9 /Http/HttpUtils.php
parent6bfd7888e845d89b550d2c40b09b44312f327fa5 (diff)
downloadsymfony-security-d18bf9e278ba86857c9696775c31b0ee03be1cfd.zip
symfony-security-d18bf9e278ba86857c9696775c31b0ee03be1cfd.tar.gz
symfony-security-d18bf9e278ba86857c9696775c31b0ee03be1cfd.tar.bz2
moved management of the locale from the Session class to the Request class
The locale management does not require sessions anymore. In the Symfony2 spirit, the locale should be part of your URLs. If this is the case (via the special _locale request attribute), Symfony will store it in the request (getLocale()). This feature is now also configurable/replaceable at will as everything is now managed by the new LocaleListener event listener. How to upgrade: The default locale configuration has been moved from session to the main configuration: Before: framework: session: default_locale: en After: framework: default_locale: en Whenever you want to get the current locale, call getLocale() on the request (was on the session before).
Diffstat (limited to 'Http/HttpUtils.php')
-rw-r--r--Http/HttpUtils.php6
1 files changed, 1 insertions, 5 deletions
diff --git a/Http/HttpUtils.php b/Http/HttpUtils.php
index a26b1bd..c11b283 100644
--- a/Http/HttpUtils.php
+++ b/Http/HttpUtils.php
@@ -127,11 +127,7 @@ class HttpUtils
try {
$parameters = $this->router->match($request->getPathInfo());
- if (isset($parameters['_locale'])) {
- $context->setParameter('_locale', $parameters['_locale']);
- } elseif ($session = $request->getSession()) {
- $context->setParameter('_locale', $session->getLocale());
- }
+ $context->setParameter('_locale', isset($parameters['_locale']) ? $parameters['_locale'] : $request->getLocale());
} catch (\Exception $e) {
// let's hope user doesn't use the locale in the path
}