[Zope3-Users] PT, i18n and dynamic attributes...how to?
Sascha Ottolski
sascha.ottolski at lalisio.com
Fri Feb 2 02:20:42 EST 2007
On Thursday 01 February 2007 23:35:54 you wrote:
> Are you new to Zope?
not quite.
> If I understand correctly, yes it is possible
> and Zope does an excellent job with this.
would you mind sharing a working example?
> Both Zope books are particularly good in explaining this. Have you referred
> to either?
Sure. It might very well be my stupidity, but up to now I couldn't find a
solution to this problem. Note that it's not solved like most examples would
suggest with
<p i18n:translate="">
Hi, please <a tal:attributes="href view/click_url"
i18n:name="click">click</a> here!
</p>
cause that would replace the whole <a> tag, so the tal:attributes gets lost
(and none of the docs I've seen so far has got an example for my case). If
I'm not mistaken, that would result in
msgid="Hi, please ${click} here!"
which is certainly not what I want.
Cheers, Sascha
>
> On Feb 1, 2007, at 5:51 PM, Sascha Ottolski wrote:
> > Hi,
> >
> > I'm wondering if there is a proper solution to a common problem:
> > translating a page template with dynamic attributes. If I put
> > something
> > like
> >
> > <p i18n:translate="">
> > Hi, please <a tal:attributes="href view/click_url">click</a>
> > here!
> > </p>
> >
> > in a page template, this wouldn't be translated properly, cause it
> > ends
> > in a msgid like
> >
> > msgid="Hi, please <a href=\"${DYNAMIC_CONTENT}\">click</a> here!"
> >
> > Therefore I end up writing
> >
> > <p tal:content="structure view/renderLink"></p>
> >
> > class MyView:
> >
> > def renderLink(self):
> > return _('Hi, please <a href="${href}">click</a> here!',
> > mapping={'href': self.click_url()}
> >
> > to get a msgid that reads
> >
> > msgid="Hi, please <a href=\"${href}\">click</a> here!"
> >
> > Isn't there a way to express the same in the PT alone? Or should the
> > first example do the trick, and it should be considered a bug that it
> > doesn't?
> >
> >
> > Thanks, Sascha
> >
> > --
> > Lalisio GmbH www.lalisio.com
> >
> > Puschkinstraße 1 fon +49-(0)361/541 43 80
> > 99084 Erfurt fax +49-(0)361/541 43 79
> > kontakt at lalisio.com
> > _______________________________________________
> > Zope3-users mailing list
> > Zope3-users at zope.org
> > http://mail.zope.org/mailman/listinfo/zope3-users
Mit freundlichen Grüssen,
Sascha Ottolski
--
Lalisio GmbH www.lalisio.com
Puschkinstraße 1 fon +49-(0)361/541 43 80
99084 Erfurt fax +49-(0)361/541 43 79
kontakt at lalisio.com
More information about the Zope3-users
mailing list