Joachim Zobel | 4 Feb 12:08
Picon
Favicon

Pluggable expression language

Hi.

I am researching for what I call Apache2::TAL. The idea is to implement
an apache output filter, that processes XML, putting it into a TAL
template. This would be straight forward using Petal if I could plug in
another expression language. The natural language in my case is XPath. 

can this be done?

Any hints appreciated.
Joachim

Fergal Daly | 4 Feb 12:21
Picon

Re: Pluggable expression language

I don't know what the code is like these days but I plugged in a new
TALES compiler a few years ago. I can't remember if the final patches
to allow plugins were accepted but if you search the archives for
Code::Perl, Petal::Code::Perl and other posts by me around that time
you might  find the answer,

F

On 04/02/07, Joachim Zobel <jzobel@...> wrote:
> Hi.
>
> I am researching for what I call Apache2::TAL. The idea is to implement
> an apache output filter, that processes XML, putting it into a TAL
> template. This would be straight forward using Petal if I could plug in
> another expression language. The natural language in my case is XPath.
>
> can this be done?
>
> Any hints appreciated.
> Joachim
>
>
>

Joachim Zobel | 16 Feb 21:36
Picon
Favicon

i18n:name - How do I use it

Hi.

I have a template containing 

<p i18n:translate="">First we want to test 
<span style="font-style: italic;" i18n:name="names">names</span>.</p>

If I apply i18nfool-extract, I get 

msgid "First we want to test ${names}."
msgstr "First we want to test ${names}."

and manually add

msgid "names"
msgstr "names"

Then I i18fool-update and edit the pot-File for de_DE to

msgid "First we want to test ${names}."
msgstr "Zuerst wollen wir ${names} testen."

msgid "names"
msgstr "Namen"

However after processing this with Petal I get

<p>Zuerst wollen wir <span style="font-style: italic;">names</span>
testen.</p>

(Continue reading)

Mark Holland | 17 Feb 19:27

Re: i18n:name - How do I use it

Hi Joachim,

You need to to use i18n:name in conjunction with a petal:content 
statement. This will interpolate the contents of the tag with the string 
store in your pot file. So in your template you have:

<p i18n:translate="">First we want to test <span style="font-style: 
italic;" i18n:name="username" petal:content="user/name">Name</span>.</p>

Petal will first go through the template and evaluate all petal: 
attributes. The output at this point will look like:

<p i18n:translate="">First we want to test <span style="font-style: 
italic;" i18n:name="username">Joachim</span>.</p>

Then Petal::I18N will go and process the i18n: attributes, giving you:

<p>First we want to test <span 
style="font-style:italic;">Joachim</span>.</p>

or in german:

<p>Zuerst wollen wir <span style="font-style:italic;">Joachim</span> 
testen.</p>

I hope this makes sense.

Viel spass,
~mark

(Continue reading)

Joachim Zobel | 18 Feb 08:00
Picon
Favicon

Re: i18n:name - How do I use it

Am Samstag, den 17.02.2007, 18:27 +0000 schrieb Mark Holland:
> You need to to use i18n:name in conjunction with a petal:content 
> statement. This will interpolate the contents of the tag with the
> string 
> store in your pot file. So in your template you have:

Ah, thx, seems I misunderstood the tal spec. To summarize:
i18n:translate translates, i18n:name only does the $ stuff. 

http://plone.org/documentation/how-to/i18n-for-developers

So

<p i18n:translate="">First we want to test 
<span style="font-style: italic;" i18n:name="names"
i18n:translate="names">names</span>.</p>

does what I want.

Sincerely,
Joachim


Gmane