[Zope3-Users] PT, i18n and dynamic attributes...how to?

David Johnson djohnson at jsatech.com
Thu Feb 1 17:35:54 EST 2007


Are you new to Zope?  If I understand correctly, yes it is possible  
and Zope does an excellent job with this.  Both Zope books are  
particularly good in explaining this.  Have you referred to either?

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
>



More information about the Zope3-users mailing list