On Thu, 20 Mar 2003, Jeff Smith wrote:

> Date: Thu, 20 Mar 2003 08:18:48 -0700
> From: Jeff Smith <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: HTML Tags proposal
>
> I have been following the thread on Country Selection Pull-down and it
> addresses an issue that has bothered me as well - how do we create
> localizable forms from bean data?
>
> The suggestion of putting localized versions of the various field labels in
> my DB (from where I build my labels bean) seems anathema to me - the more
> localization I can place in my resources file, the more efficient my
> localization project will be.
>
> Would it be possible to add an attribute to the various tags called
> "localize" which takes a true or false (default to false). If set to true,
> this tag would treat the value field of the element as a message key and get
> the final display value from the resource file?
>
> It seems to me that this would be a powerful (and fairly simple) solution to
> a number of form-localization problems.
>

One approach I've seen used for localizing dropdown lists (et. al.) goes
like this:

* At servlet init time, load up the lists for each Locale and
  make them all accessible via servlet context attributes.

* For each request, in either a Filter or an overridden
  processPreprocess() method, consult the Locale for the
  current request, and then copy the localized lists for
  that Locale to *request* attributes under well-known keys.

* Use those well-known keys in tags like <html:options> to
  pick up the already-localized version of the list.

This is similar in spirit to what Struts 1.1 already does when you're
using multiple application modules -- the ModuleConfig for each module is
stored as a servlet context attribute, and the correct one is copied to
the appropriate request attribute once Struts has figured out which module
this request belongs to.

> Jefficus
>

Craig

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

Reply via email to