[Petal] i18n:name - How do I use it

Mark Holland mark at thinkfoo.com
Sat Feb 17 18:27:34 GMT 2007


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

Joachim Zobel wrote:
> 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>
> 
> So names is not translated. How do I handle this, or is this a bug (in
> 2.18).
> 
> Sincerely,
> Joachim
> 
> 
> 
> 
> 



More information about the Petal mailing list