You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Cynick Young <cy...@utoronto.ca> on 2002/01/28 22:40:24 UTC

Velocity parsing problem

Hello,

Here's the background info on what I'm trying to do.
At the moment, we are trying to translate our english
site into french.  We have used Velocity as the template
engine so that our html designers can do the presentation.
In translating to french, we make a copy of the english
and replace all text to french by hand.

As you can image, this is not a fun job.  What I would
like to do is have a parser that processes an html or
velocity .vm file and extract any plain text and put them
into a separate properties file.  This properties file can
be translated easily and the language dependent
resource bundle can provide the text at runtime.

Does anyone know of a tool that already exists to
do this process?  It would be silly to keep mulitple
versions of the same template for internationalization.
If I need to write the parser myself, where would be
a good place to start?

Thanks in advance.
Cynick

Re: Velocity parsing problem

Posted by Cynick Young <cy...@utoronto.ca>.
Well, I was actually looking into JavaCC.
And I had a peek at the Velocity parser source.
I'm not quite sure where to start.
Should I be trying to modify the BNF grammar
and generate a new parser?  Or instantiate a
Velocity parser object and do something from there?

I would need whatever parser it is to do
the union of VTL and HTML.

Cynick

"Geir Magnusson Jr." wrote:

> On 1/28/02 4:40 PM, "Cynick Young" <cy...@utoronto.ca> wrote:
>
> > Hello,
> >
> > Here's the background info on what I'm trying to do.
> > At the moment, we are trying to translate our english
> > site into french.  We have used Velocity as the template
> > engine so that our html designers can do the presentation.
> > In translating to french, we make a copy of the english
> > and replace all text to french by hand.
> >
> > As you can image, this is not a fun job.  What I would
> > like to do is have a parser that processes an html or
> > velocity .vm file and extract any plain text and put them
> > into a separate properties file.  This properties file can
> > be translated easily and the language dependent
> > resource bundle can provide the text at runtime.
> >
> > Does anyone know of a tool that already exists to
> > do this process?  It would be silly to keep mulitple
> > versions of the same template for internationalization.
> > If I need to write the parser myself, where would be
> > a good place to start?
>
> I can easily make a tool for you that coughs out any text bits from a .vm.
>
> There are a couple of parsing tools out there, for example JavaCC which we
> use in Velocity that you might you to take a stab at the HTML problem.
>
> However, there is an HTML parser included in the JDK IIRC, and there are
> other tools out there ready made.
>
> (At worst, take apart an open source browser - what about the gekko engine?)
>
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> "Now what do we do?"
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

Re: Velocity parsing problem

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/28/02 4:40 PM, "Cynick Young" <cy...@utoronto.ca> wrote:

> Hello,
> 
> Here's the background info on what I'm trying to do.
> At the moment, we are trying to translate our english
> site into french.  We have used Velocity as the template
> engine so that our html designers can do the presentation.
> In translating to french, we make a copy of the english
> and replace all text to french by hand.
> 
> As you can image, this is not a fun job.  What I would
> like to do is have a parser that processes an html or
> velocity .vm file and extract any plain text and put them
> into a separate properties file.  This properties file can
> be translated easily and the language dependent
> resource bundle can provide the text at runtime.
> 
> Does anyone know of a tool that already exists to
> do this process?  It would be silly to keep mulitple
> versions of the same template for internationalization.
> If I need to write the parser myself, where would be
> a good place to start?

I can easily make a tool for you that coughs out any text bits from a .vm.

There are a couple of parsing tools out there, for example JavaCC which we
use in Velocity that you might you to take a stab at the HTML problem.

However, there is an HTML parser included in the JDK IIRC, and there are
other tools out there ready made.

(At worst, take apart an open source browser - what about the gekko engine?)

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"Now what do we do?"


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>