Thank you. I realize now my mistake. @ Velocity Tools 1.3, the ResourceTool does not use the locale in the request, it only does so in version 2 or greater. I must have been viewing a newer version of the javadoc.
I was able to utilize ViewResourceTool @ 1.3 to accomplish the same goal. Once we move to a newer version of Velocity Tools I can then utilize ResourceTool again. Thanks. On Tue, Apr 5, 2011 at 5:42 PM, Woonsan Ko <[email protected]> wrote: > In the v1.3 javadoc, it doesn't say anything about scope: > > http://velocity.apache.org/tools/releases/1.3/javadoc/org/apache/velocity/tools/generic/ResourceTool.html > > So, the feature may be introduced later (since 2.0?). > > Woonsan > > --- On Tue, 4/5/11, Daniel DeGroff <[email protected]> wrote: > > > From: Daniel DeGroff <[email protected]> > > Subject: Re: Using ResourceTool out of the velocity toolbox 1.3 doesn't > load translated bundles > > To: "Jetspeed Users List" <[email protected]> > > Date: Tuesday, April 5, 2011, 11:34 PM > > Yes. Sorry, I left > > that out. I have tried it both ways. > > > > <tool> > > <key>text</key> > > > > <scope>request</scope> > > > > <class>org.apache.velocity.tools.generic.ResourceTool</class> > > <parameter name="bundles" > > value="com.sometranslatedresources"/> > > > > <parameter name="locale" > > value="en_US"/> > > </tool> > > > > On Tue, Apr 5, 2011 at 2:13 PM, Woonsan Ko <[email protected]> > > wrote: > > > > > Hi Daniel, > > > > > > According to the javadoc, the toolbox should be scoped > > as 'request' in the > > > configuration. > > > Did you have that? > > > > > > Regards, > > > > > > Woonsan > > > > > > --- On Tue, 4/5/11, RobotDan <[email protected]> > > wrote: > > > > > > > From: RobotDan <[email protected]> > > > > Subject: Using ResourceTool out of the velocity > > toolbox 1.3 doesn't load > > > translated bundles > > > > To: [email protected] > > > > Date: Tuesday, April 5, 2011, 4:22 PM > > > > I'm running Jetspeed 2.2.0, and > > > > Velocity tools 1.3. > > > > > > > > In my header.vm decorator, I'm using ResourceTool > > to > > > > retrieve translated > > > > text. > > > > > > > > Here is my tool configuration. > > > > > > > > <tool> > > > > > > <key>text</key> > > > > > > > > > > <class>org.apache.velocity.tools.generic.ResourceTool</class> > > > > > > <parameter name="bundles" > > > > value="com.sometranslatedresources"/> > > > > > > <parameter name="locale" > > > > value="en_US"/> > > > > </tool> > > > > > > > > Both > > > > > > > > > > com.sometranslatedresources.properties > > > > > > com.sometranslatedresources_ja.properties > > > > > > > > exist, but the only way I can get the Japanese > > translation > > > > to work is to > > > > modify the velocity tool to have a default locale > > of "ja". > > > > > > > > According to the documentation for ResourceTool > > > > ( > > > > > > > > http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/ResourceTool.html > > > > ) > > > > > > > > *"and the default locale is > > > > either: the result of > > > > HttpServletRequest.getLocale() (if used in > > request scope of > > > > a VelocityView > > > > app)"* > > > > > > > > The request has the correct locale from the > > browser > > > > configuration. > > > > > > > > Here is my workaround in my velocity template. > > > > > > > > #set($tt = > > > > $text.locale($request.getLocale())) > > > > > > > > This seems like it should not be necessary. > > Has > > > > anyone else experienced > > > > this problem and found a resolution? > > > > > > > > > > > > Thanks. > > > > Daniel > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
