title: Implement a site-wide param to change the locale with JSF2 and CDI
body: <p>Is there a way to implement a viewParam that can change the locale eg.</p>
  
  <p><a href="http://example.com/p1.jsf?lang=en" rel="nofollow noreferrer">http://example.com/p1.jsf?lang=en</a>
  or
  <a href="http://example.com/p2.jsf?lang=fr" rel="nofollow noreferrer">http://example.com/p2.jsf?lang=fr</a></p>
  
  <p>perhaps without repeating </p>
  
  <pre><code>&lt;f:metadata&gt;
      &lt;f:viewParam name="lang" value="#{localeManager.locale}" /&gt;
  &lt;/f:metadata&gt;
  </code></pre>
  
  <p>in every xhtml page (perhaps by intercepting every xhtml request, check the value of the lang parameter and update the locale)</p>
  
  <p>A <a href="https://stackoverflow.com/questions/7344056/jsf2-how-achieve-site-wide-viewparam-handling-policy-using-a-template">similar question</a> was asked and answered but involves JSF2 @ManagedProperty and to be honest I din't not understand the answer.</p>
  
  <p>Any thoughts?</p>