Re: [Webwork-devel] Adding i18n and text support to Velocity
Brought to you by:
baldree,
rickardoberg
From: Victor S. <vsa...@ho...> - 2002-02-20 09:48:15
|
They say that waiting is a good thing :) I have all that done for velocity, including: new wwvelocityservlet featuring a context Toolbox ui templates common tools such as i18n,url,etc... integration to sitemesh for decoration But I can't commit until we release 1.0 :( So I'm stuck here... If you'd like a preview come to Efnet #java (irc) and look for me :) /V >From: "Bill Burton" <bi...@pr...> >To: WebWork Developers <web...@li...> >Subject: [Webwork-devel] Adding i18n and text support to Velocity >Date: Wed, 20 Feb 2002 00:18:21 -0500 > >Hello, > >I've been looking into the best way to add support for the equivalent of >the ww:i18n and ww:text JSP tags to Velocity. > >One thing that seems apparent is that the ValueStack needs to be exposed >to Velocity templates in some manner. This is at least true to get the >i18n functionality to work and may be necessary in other cases as well. > >I'm planning on adding the ValueStack to the VelocityContext so it can be >accessed via the key $valuestack. However, most usage will be wrapped in >macros like #pushvalue() and #popvalue() so users won't access $valuestack >directly. For user visible methods such as findValue() and test(), I've >modified WebWorkUtil adding these methods to the delegate to the same >ValueStack methods. This will allow these methods can be called using the >syntax $webwork.methodName(). In the case of findValue() that will >probably be available as $webwork.value(...). > >In the case of i18n support there would be an i18n macro that would be >called like this: > #i18n("webwork.action.test.i18n.Shop") > >By definition it would push the specified ResourceBundle on the ValueStack >thereby allowing the text support to use that ResourceBundle instead of >the default. However, because this macro isn't a block tag, there needs >to be some way of popping the ResourceBundle off the ValueStack. To do >this, I was going to expose the ValueStack popValue() method within a >macro: > #popvalue() >Which would be implemented as $valuestack.popValue(). > >In like manner there are times when an Action or Bean needs to be pushed >onto the stack. For instance: > #action("i18n.Shop", $shop) > #pushvalue($shop) > ... > #execute($shop) > ... > #popvalue() > >I'm also looking into making an i18n block directive which would scope the >ResourceBundle instance as in: > #i18n("webwork.action.test.i18n.Shop") > ... > #end > >If I can get that to work, the popValue will be implied at the #end. > >As far as support for text goes, I'm planning on adding a several text() >methods to WebWorkUtil. As a result, they'll be available via the >$webwork context name. > $webwork.text(key) > $webwork.text(key, param0) > etc. > >In order to implement the parameter support, I'll copy the TextTag class >into the .velocity package and rework it with more appropriate API's for >Velocity. After the 1.0 release, these two classes could be refactored so >they call a common class in .util. > >Thanks for any feedback, >-Bill > >_______________________________________________ >Webwork-devel mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/webwork-devel _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |