You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Smith <je...@centralscheduling.net> on 2003/03/20 16:18:48 UTC

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.

Jefficus


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


Re: HTML Tags proposal

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

On Thu, 20 Mar 2003, Jeff Smith wrote:

> Date: Thu, 20 Mar 2003 08:18:48 -0700
> From: Jeff Smith <je...@centralscheduling.net>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> 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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: HTML Tags proposal

Posted by julian green <ju...@jacobsrimell.com>.
how about this??

<jsp:include page="<%= LanguageUtil.getPreferredLanguagePath(request, 
"data/country.xml") %>" flush="true" />

Julian

Jeff Smith wrote:
> 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.
> 
> Jefficus
> 
> 
> ---------------------------------------------------------------------
> 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