Laurent

I came across this very issue yesterday, this is how I solved it (probably
straying too much from design into implementation):

I couldn't find a way to easily (or quickly) access the internals of the
messages class so I created my own.

Each varying option set (e.g. coutries, states, person titles etc.) is
mapped to a normal resource bundle file, e.g. countries_en_GB.properties
etc.

I use an application Session listener to insert into each new session a
dynamic proxy that that implements a collection interface for each
internationalised collection.

On each request for the data by a page (i.e. html:options) the dynamic proxy
queries the session for the current struts locale and retrieves the
appropriate list and passes on the call to the appropriate bundle.

Obviously caching and the like goes on so I'm not reloading files all the
time, but the net effect is that if the user changes the locale of their
session the list boxes also change.

Hope that helps. Not really a "design pattern" though ;-)

Luke

PS I'm relatively new to struts - so will follow with interest to see if
there is a more strutsy way of doing this.


-----Original Message-----
From: Tettoni, Laurent [mailto:[EMAIL PROTECTED]] 
Sent: 07 January 2002 17:15
To: '[EMAIL PROTECTED]'
Subject: options tag & internationalization

Hi,

Could anybody advise a DESIGN PATTERN for implementing internationalized
<struts-form:options> (when using a Collection) that would use internally
<struts-bean:message> (or similar) mechanism ?

Use case:
        - draw content for a combo box (names and values) from a database
        => options names here expressed as generic, language independent
keys
        - encapsulate in a Collection of dedicated objects
        - use <struts-form:options> with the specified collection
        => this would fetch localized value in the application's properties
        => and display combo box with localized content

I could not find this functionality. Any advice ?

Thanks in advance,

-Laurent





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to