You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Natalie D Rassmann <na...@lmco.com> on 2003/06/05 14:32:59 UTC

Multiple Message Resource Files

Hi,

My requirement is to have multiple message resource files not based on
Locale but based on the user's project.  For example,
I need to create a message bundle for Project A and another one for
Project B.

MessageResources_ProjectA.properties looks like this:

label.first = First Name
label.last = Last Name

MessageResources_ProjectB properties lookes like this:

label.first = First Initial
label.last = Last Initial

My question is how do I do this?  I believe it works similar to the
Struts Internationaliztion capablity where you can set a locale.
Is there some kind of variable I can set to distinguish what Project to
use?

Can anyone point me in the right direction?

Thanks in advance,

Natalie


Re: Multiple Message Resource Files

Posted by Natalie D Rassmann <na...@lmco.com>.
Thank you, I will try that.

David Chelimsky wrote:

> I know that if you're using the jstl tags you can define the bundle in
>
> the tags. So instead of:
>
> <bean:message key="some.label"/>
>
> you'd write:
>
> <fmt:message bundle="${currentBundle}" key="some.label"/>
>
> Then you can set the value of currentBundle in your Action based on
> the
> current project, or store it in the session when the user selects that
>
> project. In any case, I'm not sure if there's an equivalent in the
> struts bean tags. If not, I'd recommend using the JTSL tags.
>
> David
>
> Natalie D Rassmann wrote:
>
> >Hi,
> >
> >My requirement is to have multiple message resource files not based
> on
> >Locale but based on the user's project.  For example,
> >I need to create a message bundle for Project A and another one for
> >Project B.
> >
> >MessageResources_ProjectA.properties looks like this:
> >
> >label.first = First Name
> >label.last = Last Name
> >
> >MessageResources_ProjectB properties lookes like this:
> >
> >label.first = First Initial
> >label.last = Last Initial
> >
> >My question is how do I do this?  I believe it works similar to the
> >Struts Internationaliztion capablity where you can set a locale.
> >Is there some kind of variable I can set to distinguish what Project
> to
> >use?
> >
> >Can anyone point me in the right direction?
> >
> >Thanks in advance,
> >
> >Natalie
> >
> >
> >
>
> ------------------------------------------------------------------------
>
> >
> >---------------------------------------------------------------------
>
> >To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

RE: Multiple Message Resource Files

Posted by Mike Jasnowski <mj...@bea.com>.
Sure, it's just a string, but you would most likely have to use a jsp
expression to reference it (i.e.   bundle="<%= currentBundle %>".   Either
method (JSTL or Struts) can work, I just wanted to communicate you could
achieve the same result with the Struts tag as well.

 -----Original Message-----
From: Natalie D Rassmann [mailto:natalie.d.rassmann@lmco.com]
Sent: Thursday, June 05, 2003 9:04 AM
To: Struts Users Mailing List
Subject: Re: Multiple Message Resource Files


  I suppose I could but can I make that a variable that I can get out of the
session?
  Mike Jasnowski wrote:

    Can't you just use the "bundle" att on the Struts message tag?

    -----Original Message-----
    From: David Chelimsky [mailto:david@chelimsky.org]
    Sent: Thursday, June 05, 2003 8:55 AM
    To: Struts Users Mailing List
    Subject: Re: Multiple Message Resource Files

    I know that if you're using the jstl tags you can define the bundle in
    the tags. So instead of:

    <bean:message key="some.label"/>

    you'd write:

    <fmt:message bundle="${currentBundle}" key="some.label"/>

    Then you can set the value of currentBundle in your Action based on the
    current project, or store it in the session when the user selects that
    project. In any case, I'm not sure if there's an equivalent in the
    struts bean tags. If not, I'd recommend using the JTSL tags.

    David

    Natalie D Rassmann wrote:

    >Hi,
    >
    >My requirement is to have multiple message resource files not based on
    >Locale but based on the user's project.  For example,
    >I need to create a message bundle for Project A and another one for
    >Project B.
    >
    >MessageResources_ProjectA.properties looks like this:
    >
    >label.first = First Name
    >label.last = Last Name
    >
    >MessageResources_ProjectB properties lookes like this:
    >
    >label.first = First Initial
    >label.last = Last Initial
    >
    >My question is how do I do this?  I believe it works similar to the
    >Struts Internationaliztion capablity where you can set a locale.
    >Is there some kind of variable I can set to distinguish what Project to
    >use?
    >
    >Can anyone point me in the right direction?
    >
    >Thanks in advance,
    >
    >Natalie
    >
    >
    >

>------------------------------------------------------------------------
    >
    >---------------------------------------------------------------------
    >To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
    >For additional commands, e-mail: struts-user-help@jakarta.apache.org
    >


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: struts-user-help@jakarta.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Multiple Message Resource Files

Posted by Mark Galbreath <ma...@qat.com>.
why would you want to?  the bundle is static - it's an absolute reference

-----Original Message-----
From: Natalie D Rassmann [mailto:natalie.d.rassmann@lmco.com] 
Sent: Thursday, June 05, 2003 9:04 AM
To: Struts Users Mailing List
Subject: Re: Multiple Message Resource Files


I suppose I could but can I make that a variable that I can get out of the
session? 

Mike Jasnowski wrote: 


Can't you just use the "bundle" att on the Struts message tag? 


-----Original Message----- 
From: David Chelimsky [mailto:david@chelimsky.org] 
Sent: Thursday, June 05, 2003 8:55 AM 
To: Struts Users Mailing List 
Subject: Re: Multiple Message Resource Files 


I know that if you're using the jstl tags you can define the bundle in 
the tags. So instead of: 


<bean:message key="some.label"/> 


you'd write: 


<fmt:message bundle="${currentBundle}" key="some.label"/> 


Then you can set the value of currentBundle in your Action based on the 
current project, or store it in the session when the user selects that 
project. In any case, I'm not sure if there's an equivalent in the 
struts bean tags. If not, I'd recommend using the JTSL tags. 


David 


Natalie D Rassmann wrote: 


>Hi, 
> 
>My requirement is to have multiple message resource files not based on 
>Locale but based on the user's project.  For example, 
>I need to create a message bundle for Project A and another one for 
>Project B. 
> 
>MessageResources_ProjectA.properties looks like this: 
> 
>label.first = First Name 
>label.last = Last Name 
> 
>MessageResources_ProjectB properties lookes like this: 
> 
>label.first = First Initial 
>label.last = Last Initial 
> 
>My question is how do I do this?  I believe it works similar to the 
>Struts Internationaliztion capablity where you can set a locale. 
>Is there some kind of variable I can set to distinguish what Project to 
>use? 
> 
>Can anyone point me in the right direction? 
> 
>Thanks in advance, 
> 
>Natalie 
> 
> 
> 
>------------------------------------------------------------------------ 
> 
>--------------------------------------------------------------------- 
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org 
>For additional commands, e-mail: struts-user-help@jakarta.apache.org 
> 
  


--------------------------------------------------------------------- 
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: struts-user-help@jakarta.apache.org 
  


--------------------------------------------------------------------- 
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Multiple Message Resource Files

Posted by Natalie D Rassmann <na...@lmco.com>.
I suppose I could but can I make that a variable that I can get out of
the session?

Mike Jasnowski wrote:

> Can't you just use the "bundle" att on the Struts message tag?
>
> -----Original Message-----
> From: David Chelimsky [mailto:david@chelimsky.org]
> Sent: Thursday, June 05, 2003 8:55 AM
> To: Struts Users Mailing List
> Subject: Re: Multiple Message Resource Files
>
> I know that if you're using the jstl tags you can define the bundle in
>
> the tags. So instead of:
>
> <bean:message key="some.label"/>
>
> you'd write:
>
> <fmt:message bundle="${currentBundle}" key="some.label"/>
>
> Then you can set the value of currentBundle in your Action based on
> the
> current project, or store it in the session when the user selects that
>
> project. In any case, I'm not sure if there's an equivalent in the
> struts bean tags. If not, I'd recommend using the JTSL tags.
>
> David
>
> Natalie D Rassmann wrote:
>
> >Hi,
> >
> >My requirement is to have multiple message resource files not based
> on
> >Locale but based on the user's project.  For example,
> >I need to create a message bundle for Project A and another one for
> >Project B.
> >
> >MessageResources_ProjectA.properties looks like this:
> >
> >label.first = First Name
> >label.last = Last Name
> >
> >MessageResources_ProjectB properties lookes like this:
> >
> >label.first = First Initial
> >label.last = Last Initial
> >
> >My question is how do I do this?  I believe it works similar to the
> >Struts Internationaliztion capablity where you can set a locale.
> >Is there some kind of variable I can set to distinguish what Project
> to
> >use?
> >
> >Can anyone point me in the right direction?
> >
> >Thanks in advance,
> >
> >Natalie
> >
> >
> >
>
> ------------------------------------------------------------------------
>
> >
> >---------------------------------------------------------------------
>
> >To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

RE: Multiple Message Resource Files

Posted by Mark Galbreath <ma...@qat.com>.
yes

-----Original Message-----
From: Mike Jasnowski [mailto:mjasnows@bea.com] 
Sent: Thursday, June 05, 2003 8:58 AM
To: Struts Users Mailing List
Subject: RE: Multiple Message Resource Files


Can't you just use the "bundle" att on the Struts message tag?

-----Original Message-----
From: David Chelimsky [mailto:david@chelimsky.org]
Sent: Thursday, June 05, 2003 8:55 AM
To: Struts Users Mailing List
Subject: Re: Multiple Message Resource Files


I know that if you're using the jstl tags you can define the bundle in 
the tags. So instead of:

<bean:message key="some.label"/>

you'd write:

<fmt:message bundle="${currentBundle}" key="some.label"/>

Then you can set the value of currentBundle in your Action based on the 
current project, or store it in the session when the user selects that 
project. In any case, I'm not sure if there's an equivalent in the 
struts bean tags. If not, I'd recommend using the JTSL tags.

David


Natalie D Rassmann wrote:

>Hi,
>
>My requirement is to have multiple message resource files not based on 
>Locale but based on the user's project.  For example, I need to create 
>a message bundle for Project A and another one for Project B.
>
>MessageResources_ProjectA.properties looks like this:
>
>label.first = First Name
>label.last = Last Name
>
>MessageResources_ProjectB properties lookes like this:
>
>label.first = First Initial
>label.last = Last Initial
>
>My question is how do I do this?  I believe it works similar to the 
>Struts Internationaliztion capablity where you can set a locale. Is 
>there some kind of variable I can set to distinguish what Project to 
>use?
>
>Can anyone point me in the right direction?
>
>Thanks in advance,
>
>Natalie
>
>  
>
>-----------------------------------------------------------------------
>-
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Multiple Message Resource Files

Posted by Mike Jasnowski <mj...@bea.com>.
Can't you just use the "bundle" att on the Struts message tag?

-----Original Message-----
From: David Chelimsky [mailto:david@chelimsky.org]
Sent: Thursday, June 05, 2003 8:55 AM
To: Struts Users Mailing List
Subject: Re: Multiple Message Resource Files


I know that if you're using the jstl tags you can define the bundle in 
the tags. So instead of:

<bean:message key="some.label"/>

you'd write:

<fmt:message bundle="${currentBundle}" key="some.label"/>

Then you can set the value of currentBundle in your Action based on the 
current project, or store it in the session when the user selects that 
project. In any case, I'm not sure if there's an equivalent in the 
struts bean tags. If not, I'd recommend using the JTSL tags.

David


Natalie D Rassmann wrote:

>Hi,
>
>My requirement is to have multiple message resource files not based on
>Locale but based on the user's project.  For example,
>I need to create a message bundle for Project A and another one for
>Project B.
>
>MessageResources_ProjectA.properties looks like this:
>
>label.first = First Name
>label.last = Last Name
>
>MessageResources_ProjectB properties lookes like this:
>
>label.first = First Initial
>label.last = Last Initial
>
>My question is how do I do this?  I believe it works similar to the
>Struts Internationaliztion capablity where you can set a locale.
>Is there some kind of variable I can set to distinguish what Project to
>use?
>
>Can anyone point me in the right direction?
>
>Thanks in advance,
>
>Natalie
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Multiple Message Resource Files

Posted by David Chelimsky <da...@chelimsky.org>.
I know that if you're using the jstl tags you can define the bundle in 
the tags. So instead of:

<bean:message key="some.label"/>

you'd write:

<fmt:message bundle="${currentBundle}" key="some.label"/>

Then you can set the value of currentBundle in your Action based on the 
current project, or store it in the session when the user selects that 
project. In any case, I'm not sure if there's an equivalent in the 
struts bean tags. If not, I'd recommend using the JTSL tags.

David


Natalie D Rassmann wrote:

>Hi,
>
>My requirement is to have multiple message resource files not based on
>Locale but based on the user's project.  For example,
>I need to create a message bundle for Project A and another one for
>Project B.
>
>MessageResources_ProjectA.properties looks like this:
>
>label.first = First Name
>label.last = Last Name
>
>MessageResources_ProjectB properties lookes like this:
>
>label.first = First Initial
>label.last = Last Initial
>
>My question is how do I do this?  I believe it works similar to the
>Struts Internationaliztion capablity where you can set a locale.
>Is there some kind of variable I can set to distinguish what Project to
>use?
>
>Can anyone point me in the right direction?
>
>Thanks in advance,
>
>Natalie
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org