title: How to get the _locale variable inside in a Symfony layout?
body: <p>I'm working with Symfony 2 on a site which having 2 languages,
  and I want to change patterns of my routes depending on user locale language !</p>
  
  <p>Example:</p>
  
  <pre><code>user_login_en:
      pattern:  /en/user/login.html
      defaults: { _controller: SfErrorsAppBundle:User:login, _locale: en }
  
  user_login_fr:
      pattern:  /fr/utilisateur/connexion.html
      defaults: { _controller: SfErrorsAppBundle:User:login, _locale: fr}
  </code></pre>
  
  <p>Inside a template, this is not difficult, i just have to pass the $this->get('session')->getLocale() from the controller to the template...</p>
  
  <p>To work, I have to call my routes:</p>
  
  <pre><code>$router-&gt;generate('user_login_'.$locale, array());
  </code></pre>
  
  <p>But  inside my layouts, I have of course a menu, and sidebars, which have links... So I want to get the locale variable to use it ! So my question is simple: how to get this variable inside a "layout" template ? Otherwise, have you got any idea to change the pattern depending on the language ?</p>
  
  <p>The reasons are that I want beautiful routes for all users, whether they're english or french... And also for a SEO reason !</p>