3 Replies Latest reply on Oct 25, 2011 9:27 AM by RatKing

    Seam-International Glassfish 3.1 - AvailableLocales

    Heiko Kopp Newbie

      Hello,


      I've been trying to utilize seam-international (3.1.0-beta3) in an application deployed at the current Glassfish 3.1. I've followed the documentation and implemented a class to retrieve the current users locale as well as being able to change it via the event.


      However, for me it seems impossible to implement a way to retrieve all available locales. I've implemented a class as found in the documentation:



      import javax.annotation.PostConstruct;
      
      import org.jboss.seam.international.locale.LocaleConfiguration;
      
      public class CustomLocaleConfiguration extends LocaleConfiguration 
      {
          @PostConstruct
          public void setup() 
          {
              addSupportedLocaleKey("en");
              addSupportedLocaleKey("de");
          }
      }



      In an application scoped bean, I try to inject all available locales as follows:





      @Named
      @SessionScoped
      public class LocaleManager implements Serializable
      {
          ...
          @Inject
          private List<Locale> locales;
      
          public List<Locale> getLocales()
          {
              return locales;
          }
      }



      However, this injected attribute is always an empty list. My custom implementation (CustomLocaleConfiguration) is never called. I've tracked down, that method init() of the class org.jboss.seam.international.locale.AvailableLocales is called, but somehow configuration.isUnsatisfied() is always 'true', so no configuration is retrieved.


      What am I missing here to configure. The documentation is very limited on the module, despite containing a valuable example that actually works.


      Besides this configuration, no other configuration is done right now. I've refused to add any XML-based configuration, cause I do not want XML anymore, thats the reason behind switching to CDI, isn't it?


      Thank you for your help,


      Best regards,


      Heiko