title: Slim 3: best way to pass variables (that depends on request) to layout?
body: <p>I need to pass variable to a Twig layout about user country and language.</p>
  
  <p>These datas are determined from the route, so I can't get them before routing is done.</p>
  
  <p>I could set them from the route callbacks but code would be repeated in each route.</p>
  
  <p>So I added a middleware to routes. It reads request arguments and sets variables (through <code>$twig-&gt;getEnvironment()-&gt;addGlobal(...)</code>).</p>
  
  <p>I am not fully convinced, is there a better way to achieve this?</p>
  
  <p>thanks</p>