You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-dev@incubator.apache.org by Simon Lessard <si...@gmail.com> on 2007/03/10 19:04:49 UTC

Check for application specific resource bundle before the embedded one

Hello all,

Currently, LocaleUtils loads resources from the embedded
org.apache.myfaces.trinidad.resource.MessageBundle class before checking for
the FacesMessage.FacesMessages bundle, leaving the application specific
bundle completely out of the process, effectivelly preventing users from
overloading the predefined Trinidad messages. Currently, the only workaround
for this is the create a class named
org.apache.myfaces.trinidad.resource.MessageBundle in your project and pray
for the AS ClassLoader to load it before the jarred one. Therefore, I think
we should add the application defined (in faces-config.xml) ResourceBundle
as the top priority bundle for text resources.

Any comments?


Regards,

~ Simon

Re: Check for application specific resource bundle before the embedded one

Posted by Adam Winer <aw...@gmail.com>.
I guess +1  The spec only truly requires this for messages
that are created by the JSF implementation, but it's common
practice to apply this to other messages.

-- Adam


On 3/13/07, Gabrielle Crawford <ga...@oracle.com> wrote:
>
>  +1 This seems to match the spec, which defines the algorithm below, so we'd
> just use org.apache.myfaces.trinidad.resource.MessageBundle
> instead of javax.faces.Messages.
>
>
> The following algorithm must be used to create a FacesMessage instance given
> a message
>  key.
>  ■ Call getMessageBundle() on the Application instance for this web
> application,
>  to determine if the application has defined a resource bundle name. If so,
> load that
>  ResourceBundle and look for the message there.
>  ■ If not there, look in the javax.faces.Messages resource bundle.
>  thanks,
>
>  Gab
>
>
>  On 3/10/2007 11:04 AM, Simon Lessard wrote:
> Hello all,
>
>  Currently, LocaleUtils loads resources from the embedded
>  org.apache.myfaces.trinidad.resource.MessageBundle class
> before checking for
>  the FacesMessage.FacesMessages bundle, leaving the application specific
>  bundle completely out of the process, effectivelly preventing users from
>  overloading the predefined Trinidad messages. Currently, the only
> workaround
>  for this is the create a class named
>  org.apache.myfaces.trinidad.resource.MessageBundle in your
> project and pray
>  for the AS ClassLoader to load it before the jarred one. Therefore, I think
>  we should add the application defined (in faces-config.xml) ResourceBundle
>  as the top priority bundle for text resources.
>
>  Any comments?
>
>
>  Regards,
>
>  ~ Simon
>
>

Re: Check for application specific resource bundle before the embedded one

Posted by Gabrielle Crawford <ga...@oracle.com>.
+1 This seems to match the spec, which defines the algorithm below, so we'd
just use org.apache.myfaces.trinidad.resource.MessageBundle instead of
javax.faces.Messages.  
  

> The following algorithm must be used to create a FacesMessage instance given
> a message  
>  key.  
>  ■ Call getMessageBundle() on the Application instance for this web
> application,  
>  to determine if the application has defined a resource bundle name. If so,
> load that  
>  ResourceBundle and look for the message there.  
>  ■ If not there, look in the javax.faces.Messages resource bundle.  
>

thanks,  
  
Gab  
  
On 3/10/2007 11:04 AM, Simon Lessard wrote:

> Hello all,  
>  
>  Currently, LocaleUtils loads resources from the embedded  
>  org.apache.myfaces.trinidad.resource.MessageBundle class before checking
> for  
>  the FacesMessage.FacesMessages bundle, leaving the application specific  
>  bundle completely out of the process, effectivelly preventing users from  
>  overloading the predefined Trinidad messages. Currently, the only
> workaround  
>  for this is the create a class named  
>  org.apache.myfaces.trinidad.resource.MessageBundle in your project and pray  
>  for the AS ClassLoader to load it before the jarred one. Therefore, I think  
>  we should add the application defined (in faces-config.xml) ResourceBundle  
>  as the top priority bundle for text resources.  
>  
>  Any comments?  
>  
>  
>  Regards,  
>  
>  ~ Simon  
>  
>