[ZPT] Coming changes in page templates

Fred L. Drake, Jr. fred@zope.com
Fri, 28 Mar 2003 14:05:41 -0500


Message IDs and i18n:attributes:
--------------------------------

We're planning on changing the TAL i18n:attributes syntax to add
support for explicit message IDs.

This change is not completely compatible with the existing behavior,
but is necessary.  We don't expect it to actually break anyone's
templates, but wanted to give a "heads up" just in case.  For
templates which only use i18n:attributes to flag one attribute for
translation at a time (i18n:attributes="foo"), there will be no
change.

The current i18n:attributes definition states:

    This attribute will allow us to translate attributes of HTML tags,
    such as the alt attribute in the img tag.  The i18n:attributes
    attribute specifies a list of attributes to be translated; if
    multiple attribute names are given, they must be separated by
    spaces.

This will change in the following ways:

    1. Semi-colons will be used to separate attributes.

    2. Attribute names may be followed by an explicit message ID,
       separated from the ID by whitespace.  The message ID may not
       contain spaces.

For example:

    <input type="submit"
           value="Delete"
           i18n:attributes="value menu-delete-button-label" />

means:

    Look up a translation for the message id
    menu-delete-button-label. If you find one, change the value of the
    value attribute to the translation, otherwise, leave it alone.

Templates that specify two or more attributes to translate will see
one of two failure modes.  In the case of exactly two attributes (in
the old syntax), the result will be that the first will be translated
using the name of the second as the message ID.  This will yield
unexpected results, but not an error.  In the case of more than two
attributes, an error will be raised when the template is compiled.

Please send comments on this change to the ZPT list.


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation