title: JSF 2.2 internationalization
body: <p>I have tried <a href="http://www.mkyong.com/jsf2/jsf-2-internationalization-example/" rel="nofollow">MKyiong's</a> and <a href="http://examples.javacodegeeks.com/enterprise-java/jsf/jsf-internationalization-example/" rel="nofollow">javacodegeeks's</a>  good guides - everything is working fine.</p>
  
  <p>I have a template that contains navigation bar, contact info stored in WEB-INF/templates/default.xhtml.
  In this template I have a block containing</p>
  
  <pre><code>&lt;div id="content"&gt;
   &lt;ui:insert name="content"&gt;
     [Template content will be inserted here]
   &lt;/ui:insert&gt;
  </code></pre>
  
  <p>In my file <code>WEB-INF/langTest.xhtml</code> I try</p>
  
  <pre><code>    &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      template="/WEB-INF/templates/default.xhtml"&gt;
      &lt;ui:define name="content"&gt;     &lt;h:form&gt;
  
      &lt;h2&gt;&lt;h:outputText value="#{msg['welcome.jsf']}" /&gt;&lt;/h2&gt;
      &lt;h:panelGrid columns="2"&gt;
          Language : 
          &lt;h:selectOneMenu value="#{language.localeCode}" onchange="submit()"
              valueChangeListener="#{language.countryLocaleCodeChanged}"&gt;
              &lt;f:selectItems value="#{language.countriesInMap}" /&gt; 
          &lt;/h:selectOneMenu&gt;
      &lt;/h:panelGrid&gt;
        &lt;/h:form&gt;
      &lt;/ui:define&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>When I run the project, visually everything is working, template is OK.
  If I change my Firefox=>Preferences=>Content=>Languages settings everything is displayed in that language
  BUT 
  If I want to change it by selecting other language from the dropdown menu 
  all the parts <code>#{msg['welcome.jsf']}</code> does NOT change, they display the language that is defined in the browser properties.</p>
  
  <p>I have put a this <code>#{language.language}</code> in my <code>WEB-INF/templates/default.xhtml</code>
  And it showing me that the Managed bean is accepting my language selection from the dropdown, but no effect on the <code>#{msg['welcome.jsf']}</code></p>
  
  <p>I think that I'm missing</p>
  
  <pre><code>&lt;html lang="#{localeBean.language}"
  xmlns:f="http://java.sun.com/jsf/core" 
  xmlns:h="http://java.sun.com/jsf/html"&gt;&lt;f:view locale="#{localeBean.locale}"&gt;...&lt;/f:view&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Thanks.</p>