1 2 Previous Next 22 Replies Latest reply on Jun 26, 2011 11:48 PM by Ricardo Martinelli Oliveira

    Seam International Module

    elfuhrer Novice

      The documentation in seam international is confusing, the snapshots docs and the seam-3.0.0.Final release docs are very different.


      I'm trying to localize a sample application to support three languages and I can't get it done, for some reason changing the locale doesn't update the messages.


      I have the following in beans.xml




      <beans xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:s="urn:java:seam:core" 
              xmlns:lc="urn:java:org.jboss.seam.international.locale"
              xsi:schemaLocation="
                  http://java.sun.com/xml/ns/javaee 
                  http://docs.jboss.org/cdi/beans_1_0.xsd">
      
          <lc:AvailableLocales>
              <s:specializes/>
              <lc:supportedLocaleKeys>
                  <s:value>en</s:value>
                  <s:value>fr</s:value>
              </lc:supportedLocaleKeys>
          </lc:AvailableLocales>
      </beans>
      



      I have in the webapp resource's folder the properties files, resources.properties and resources_fr_FR.properties


      The following is my faces-config.xml configuration




      <?xml version="1.0"?>
      <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
                    version="2.0">
          <application>
              <resource-bundle>
                  <base-name>resources</base-name>
                  <var>resources</var>
              </resource-bundle>
          </application>    
      </faces-config>



      the following bean handles switching the locales:




      @Named
      public class LocaleManager extends LocaleConfiguration {
      
          @Inject
          List<java.util.Locale> locales;
      
          @Inject
          @Alter
          @Client
          private Event<java.util.Locale> localeEvent;
      
          @Inject
          private java.util.Locale locale;
      
          @PostConstruct
          public void initLocales() {
              addSupportedLocaleKey("en");
              addSupportedLocaleKey("fr");
          }
      
          public void updateLanguage() {
              locale = Locale.FRANCE;
              localeEvent.fire(locale);
          }
      }



      and finally i'm firing the event from a jsf form



      <h:form>
          <h:commandButton value="Update Locale" action="#{localeManager.updateDefaultLocale}" />
      </h:form>




      When I click on the button the messages are not changed, what am I missing in here?


        1 2 Previous Next