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]
>
>

Reply via email to