You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Gross <m....@evolt.de> on 2002/06/28 18:56:27 UTC

Re[2]: i18n and beans

Hi Craig,

the problem is the values of my bean are stored in a database and can
be changed by the users. I would prefer to keep all the values for the
bean in one table in the database.

Martin


> One really simple approach is to have a getDescriptionKey() method that
> returns the message key of the message you want from a MessageResources
> bundle, and use that value in (say) a <bean:message> tag in your page.
> Then, you don't have to mess around with things like adding a new method
> every time you support a new language.

> Craig

> On Fri, 28 Jun 2002, Martin Gross wrote:

>> Date: Fri, 28 Jun 2002 17:39:44 +0200
>> From: Martin Gross <m....@evolt.de>
>> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>,
>>      Martin Gross <m....@evolt.de>
>> To: struts-user@jakarta.apache.org
>> Subject: i18n and beans
>>
>> I have a JavaBean which contains text in several languages. The text
>> is returned by several methods:
>>
>> e.g. getGermanDescription()
>>      getEnglishDescrption()
>>
>> Is there a way to select the appropriate method for the current locale
>> in struts 1.02?
>>
>> Other ideas to internationalize a JavaBean are also welcome!
>>
>>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]: i18n and beans

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 28 Jun 2002, Martin Gross wrote:

> Date: Fri, 28 Jun 2002 18:56:27 +0200
> From: Martin Gross <m....@evolt.de>
> To: struts-user@jakarta.apache.org
> Cc: craigmcc@apache.org
> Subject: Re[2]: i18n and beans
>
> Hi Craig,
>
> the problem is the values of my bean are stored in a database and can
> be changed by the users. I would prefer to keep all the values for the
> bean in one table in the database.
>

Sounds like a good opportunity to write a custom MessageResources
implementation that grabs messages out of the database instead.  Then you
could leverage the existing tags and still get the benefits of dynamic
updates to the descriptions.

> Martin
>

Craig


>
> > One really simple approach is to have a getDescriptionKey() method that
> > returns the message key of the message you want from a MessageResources
> > bundle, and use that value in (say) a <bean:message> tag in your page.
> > Then, you don't have to mess around with things like adding a new method
> > every time you support a new language.
>
> > Craig
>
> > On Fri, 28 Jun 2002, Martin Gross wrote:
>
> >> Date: Fri, 28 Jun 2002 17:39:44 +0200
> >> From: Martin Gross <m....@evolt.de>
> >> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>,
> >>      Martin Gross <m....@evolt.de>
> >> To: struts-user@jakarta.apache.org
> >> Subject: i18n and beans
> >>
> >> I have a JavaBean which contains text in several languages. The text
> >> is returned by several methods:
> >>
> >> e.g. getGermanDescription()
> >>      getEnglishDescrption()
> >>
> >> Is there a way to select the appropriate method for the current locale
> >> in struts 1.02?
> >>
> >> Other ideas to internationalize a JavaBean are also welcome!
> >>
> >>
>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>