0 Replies Latest reply on May 8, 2012 12:47 PM by martyhall

    Localization Fails for Composite Components?

      I cannot get localization to work for composite components. I thought that if you had a component blah.xhtml and then blah.properties and blah_es.properties in the same folder, that if the Locale was Spanish, blah_es.properties would be loaded (replacing any earlier values of the same key name from the default file), and only the default blah.properties would be loaded otherwise. However, in all my tests, only blah.properties gets loaded, regardless of the Locale.

      I have this:

      Page that has Locale set to English and uses utils:testComponent
      The Locale is set via f:view locale="#{userSettings.englishLocale}"
      Page that has Locale set to Spanish and uses utils:testComponent
      The Locale is set via f:view locale="#{userSettings.spanishLocale}"
      The getSpanishLocale method just returns a Locale object, but if in that method I also do
      FacesContext.getCurrentInstance().getViewRoot().setLocale, it makes no difference.
      Composite component that outputs both #{facesContext.viewRoot.locale}
      and #{cc.resourceBundleMap.key1}
      File with key1=English value
      File with key1=Spanish value

      When I access english.jsf, it shows that the Locale is "en" and outputs "English value". But, when I access spanish.jsf, it shows that the Locale is "es", yet it outputs "English value".

      If anyone wants the full code, I put it on coreservlets.com/temp/ (as a .zip file which is an Eclipse project, and also as a .war file with source included).

      This example was with Mojarra 2.1.7 (the latest stable Mojarra version as of today), but I got the same behavior with at least one earlier Mojarra version.

      Am I missing something about how L10N is supposed to work with composite components, or is this a Mojarra bug?

                     - Marty