velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <>
Subject Re: Question on using text from resource bundles
Date Thu, 13 Jan 2005 16:29:54 GMT
Chris Bailey <> 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, 
> have some of the abilities provided by MessageFormat.  Essentially, I¹m
> looking for something similar to the ³fmt² JSTL tags (³fmt:message² and 
> 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 
> Velocity?  It seems reasonable to put this in your view/Velocity markup, 
> 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 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message