Re: [Webwork-devel] Adding i18n and text support to Velocity
Brought to you by:
baldree,
rickardoberg
From: Bill B. <bi...@pr...> - 2002-02-21 05:51:48
|
Hi Victor, Victor Salaman wrote: > > My changes have 0 impact on compatibility. I just don't feel like adding > stuff inside the release cycle. Right, because there's almost nothing to be incompatible with yet :) . Okay. I won't work on this further and wait for your commit after 1.0 is released. > /V -Bill > >From: "Bill Burton" <bi...@pr...> > >To: Victor Salaman <vsa...@ho...> > >CC: web...@li... > >Subject: Re: [Webwork-devel] Adding i18n and text support to Velocity > >Date: Wed, 20 Feb 2002 16:50:11 -0500 > > > >Hello Victor, > > > >Victor Salaman wrote: > > > > > > 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 :( > > > >Yes, your changes seem fairly extensive. > > > >I was trying to implement something minimal that could make it into 1.0 > >since not having the i18n and text support at all for Velocity for the 1.0 > >release is rather bad IMHO. The UI stuff is nice-to-have but not a core > >feature like i18n and text are which is why I think at least a minimal > >solution needs to be in 1.0. > > > >Have figured out a way of implementing a subset of i18n and text support > >entirely within Velocity macros. However I think minimal text support (no > >parameters) and i18n would be better as a simple methods within > >WebWorkUtil with a simple macro wrapper for i18n. The changes are quite > >simple and would not be destabilizing. > > > >If there are no objections, I'd still like to do this but in a manner > >that's forward compatible with your implementation. Or maybe a subset of > >your changes for i18n and text support would be acceptable for inclusion > >into 1.0? > > > > > So I'm stuck here... If you'd like a preview come to Efnet #java (irc) > >and > > > look for me :) > > > >Will need to get an IRC client first ... > > > >Is there anything you could send me that describes how your version if the > >i18n and text stuff is called? > > > > > /V > > > >This webwork-devel list is really slow. I still haven't seen your message > >from the list yet. > > > >-Bill > > > > > >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 > > > > |