You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Victor Wiewiorowski <vw...@valuecommerce.ne.jp> on 2003/04/02 08:09:26 UTC

1.4-dev, overriding Uberspect, would like Info class to contain C ontext

I am working on a multi-lingual web-application, I would like to display
dates (for example) in a format specific to the locale the application user 
has requested. As this is a web-app serving multiple users, the 
JVM Locale is of no use to me.

I was thinking that it would be nice if I could do this transparently, that 
is within velocity whenever a Date is returned wrap it in a DateBean
which is constructed with the locale and displays the date appropriately.

I can *almost* do this in velocity-1.4-dev by writing my own 
Uberspect which wraps the default UberspectImpl returning a wrapper 
class in getPropertyGet.

However when it comes to evaluation I have no way of knowing for
which context this evaluation is for, so I don't know what Locale the
Date should be displayed in.

I think what needs to be done is the Info class should include the context 
for which the evaluation is happening, this will make it possible to make 
much more interesting Uberspect-s.

Thank you for all your hard work, and making Velocity the wonderful tool 
it is. 

Regards,

Victor Wiewiorowski
ValueCommerce Co., Ltd.

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


Re: 1.4-dev, overriding Uberspect, would like Info class to contain C ontext

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On Wednesday, April 2, 2003, at 01:09 AM, Victor Wiewiorowski wrote:

>
> I am working on a multi-lingual web-application, I would like to 
> display
> dates (for example) in a format specific to the locale the application 
> user
> has requested. As this is a web-app serving multiple users, the
> JVM Locale is of no use to me.
>
> I was thinking that it would be nice if I could do this transparently, 
> that
> is within velocity whenever a Date is returned wrap it in a DateBean
> which is constructed with the locale and displays the date 
> appropriately.
>
> I can *almost* do this in velocity-1.4-dev by writing my own
> Uberspect which wraps the default UberspectImpl returning a wrapper
> class in getPropertyGet.
>
> However when it comes to evaluation I have no way of knowing for
> which context this evaluation is for, so I don't know what Locale the
> Date should be displayed in.
>
> I think what needs to be done is the Info class should include the 
> context
> for which the evaluation is happening, this will make it possible to 
> make
> much more interesting Uberspect-s.
>

I certainly see the need, but, well, yuck :)

What I don't understand is why you don't deal with this at a higher 
level - i.e. because it's a formatting issue, the designer making the 
template knows when they are showing the date, and thus can use a tool 
placed into the context to format appropriate to that request.

Does that make sense?

geir

-- 
Geir Magnusson Jr                                   203-956-2604(w)
Adeptra, Inc.                                       203-434-2093(m)
geirm@adeptra.com                                   203-247-1713(m)


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