[Zope3-Users] Little problem with I18n properties

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Jan 8 03:27:06 EST 2007

On Monday 20 November 2006 06:12, Thierry Florac wrote:
>         class BaseForm(formlib.EditForm):
>           @property
>           def title(self):
>             return "%s: %s" %
>         (II18n(self.context).queryAttribute('title'),
>                                self._title)

This is not correct. You have three choices:

1. The following examples assumes the title attribute is already translated:

_("$title: %s" %self.title,
   mapping={'title': II18n(self.context).queryAttribute('title')})

2. Translate in the Python code. Use the i18n.translate() method to translate 
inside the Python code.

3. Use ZPT to concetanate the strings:

  <span tal:replace="view/titleAttr" />:
  <span tal:replace="view/_title" />

>  - as soon as I put, for example, "string:${view/_title}", translation
> is not done...

If this is true (title with an _), then this is a bug.

Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training

More information about the Zope3-users mailing list