On Fri, 14 Dec 2001, Ted Husted wrote:
> Date: Fri, 14 Dec 2001 18:18:18 -0500
> From: Ted Husted <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: i18n Forwards
>
> Have we ever talked about a standard subclass for ActionForward that
> would automatically expand a path based on the user's locale. I'm pretty
> sure this has come up on the user list, where people were changing the
> forward dynamically in the Action. But maybe we should have a standard
> ActionForward subclass so that you could do like
>
> <forward name="whatever" path="\pages\{*}\whatever.jsp" locale="true"/>
>
> and have it expand to
>
> \pages\es\whatever.jsp or
> \pages\en\whatever.jsp
>
> at runtime.
>
> Or is that too application specific?
>
> The message resources are great for cobbling together messages, but I
> doubt that it would be a good solution for larger sites.
>
> But then, what do I know about i18n projects ;-)
>
I like the idea.
I think the Apache pattern is to add a Locale suffix (/pages/whatever.jsp
--> /pages/whatever.jsp.es). This would probably not work well when JSP
pages are extension mapped, but using a replacement pattern lets the user
configure this to match their own environment.
I would suggest the following as implementation considerations:
* We can just make the existing ActionForward class smarter by adding
a Locale property that defaults to "false".
* IMHO, the existing "path" property getter method should continue to
return the pattern itself.
* We would add new getPath(Locale locale) method (or some such) that
performs the replacement if locale is true, or the value of getPath()
if locale is false.
* Perhaps the replacement code in the pattern should be {0} so that it
acts like internationalized message strings in resource bundles?
Craig
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel +1 716 737-3463
> -- http://www.husted.com/struts/
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>