5 Replies Latest reply on Feb 23, 2005 10:45 AM by julien1

    Portlets and ResourceBundle

      has anyone figured out how to use resource bundles in a portlet ?

      I configured my portlet.xml to use a rb:

      <portlet-name>Blah</portlet-name>
      ....
      <resource-bundle>com.blah.Blah<resource-bundle>
      <portlet-info>
      Title
      <short-title>Short Title</short-title>
      keywords
      </portlet-info>
      ....

      I added
      web-inf/classes/com.blah.Blah.properties
      web-inf/classes/com.blah.Blah_en.properties
      web-inf/classes/com.blah.Blah_fr.properties

      with content like
      javax.portlet.title=english Blah
      javax.portlet.short-title=The Title
      javax.portlet.description=dunno
      javax.portlet.keywords=blah, more blah


      When I call getResourceBundle(request.getLocale()); inside a doView (the browsers locale is en) I get a bundle, but it's locale (rb.getLocale()) is null, and I get the entries from the descriptor no matter what (not the ones from the rb) via rb.getString("javax.portlet.title");

      commenting the values for title etc. in the portlet.xml leads to exceptions at runtime, like:
      java.util.MissingResourceException: Can't find resource for bundle org.jboss.portal.common.util.ParentChildResourceBundl
      e, key javax.portlet.title
      at java.util.ResourceBundle.getObject(ResourceBundle.java:326)
      at java.util.ResourceBundle.getString(ResourceBundle.java:286)
      at javax.portlet.GenericPortlet.getTitle(GenericPortlet.java:87)

      I also tried to use a ListResourceBundle with the same results.

      What am I missing ?