-
1. Re: Seam's ApplicationBundles ignores the JSF ApplicationWrapper when loading resource bundles
evantoliopoulos Apr 4, 2012 11:18 PM (in response to evantoliopoulos)1 of 1 people found this helpfulI have worked around the problem by creating a concrete Java resource bundle class that can be passed to Seam's BundleKey:
package com.yourcompany.i18n; import java.util.Enumeration; import java.util.ResourceBundle; import javax.faces.context.FacesContext; public class MessagesResourceBundle extends ResourceBundle { public MessagesResourceBundle() { final FacesContext facesContext = FacesContext.getCurrentInstance(); final ResourceBundle resourceBundle = facesContext.getApplication().getResourceBundle(facesContext, "messages"); setParent(resourceBundle); } @Override protected Object handleGetObject(String key) { return parent.getObject(key); } @Override public Enumeration<String> getKeys() { return parent.getKeys(); } }
And to use this, we can do as normal:
new BundleKey("com.yourcompany.i18n.MessagesResourceBundle", "yourMessageKey");
It would be nice if Seam 3 just used the standard faces application getResourceBundle method, but in the mean time this will do.
-
2. Re: Seam's ApplicationBundles ignores the JSF ApplicationWrapper when loading resource bundles
kenfinni Apr 5, 2012 9:59 AM (in response to evantoliopoulos)1 of 1 people found this helpfulEvan,
The reason that Seam 3 International has a different way to retrieve a ResourceBundle than JSF, is because it does not, and will not, have any dependency on JSF, so that functionality is unavailable to it.
Seam 3 International is view agnostic, so anything that is JSF specific that needs to be built on top of International, should be added to Seam 3 Faces. I am not certain, but there may already be a way to do this in Seam 3 Faces.
Ken
-
3. Re: Seam's ApplicationBundles ignores the JSF ApplicationWrapper when loading resource bundles
evantoliopoulos Apr 18, 2012 2:35 AM (in response to kenfinni)Hi Ken,
I'll have a look in the Seam 3 Faces module to see what I can find.
Though, I am now beginning to wonder if the Seam 3 International provides much value over the ordinary JSF messages functionality. It seems a bit clunky.
If I discover anything useful I'll update this thread.
Thanks,
Evan