velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@alaska.net>
Subject Re: Question on using text from resource bundles
Date Thu, 13 Jan 2005 16:29:54 GMT
Chris Bailey <chbailey@adobe.com> wrote:
> I¹m relatively new to Velocity and have one issue I¹m trying to find out
> more info on.  I¹m using Velocity for a web app, and one that will be
> localized in many languages.  So, for my web pages (which are all done via
> Velocity), I¹d like to retrieve text via a resource bundle, and further, 
to
> have some of the abilities provided by MessageFormat.  Essentially, I¹m
> looking for something similar to the ³fmt² JSTL tags (³fmt:message² and 
its
> subtag ³fmt:param²).
> 
> Or, a better question might be, what would the ³best practices² be for
> Velocity in this regard?  How are people doing this type of thing when 
using
> Velocity?  It seems reasonable to put this in your view/Velocity markup, 
as
> it¹s view/presentation specific, but I haven¹t been able to find any
> information on this kind of thing.

I use Struts and velocity.   Struts contains a MessageResource class to 
handle this, and Velocity makes it available via the Struts tools.

I believe that the MessageResource classes have now been made into a 
separate Apache Commons MessageResources class, and that might be something 
for you to look into.

Or you could just write your own custom velocity tool (perhaps using the 
struts one as a basis) if that's not a good fit.   A velocity tool is just a 
java class that's stuck into the Velocity context so you can call methods on 
it.

-Mike

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


Mime
View raw message