Premise:

I am writing a Pre Filter, using filterDOM, to locate all elements
that contain an i18n:translate attribute.  These elements extracted
from the DOM, wrapped in an element that contains information about
the translation, eg the token used to look up the translation and any
i18n:name attributes that may exist, and then the wrapper is inserted
in its place.

Goal (in case this sounds crazy to you):

Working on a "point and click" translation editor, allowing users to
simply click on the appropriate UI element to activate a WYSIWYG for
that particular translated item.

Problem:

I'm so far unable to find documentation on or figure out how to get
standard PHPTAL attributes, eg "tal:attributes" to evaluate after
they've been inserted by the Pre Filter.  I've got pretty much
everything working, but this is was I'm currently ending up with:

<translation variables="" tal:attributes="token string:account" language="en">

where as I want it to look like:

<translation variables="" token="account" language="en">


Relevant Code:

foreach(...) {
...
$new_attrs = array();
$new_attrs[] = new PHPTAL_Dom_Attr("variables","",implode(",",$vars),"UTF-8");
$new_attrs[] = new PHPTAL_Dom_Attr("tal:attributes","","token
{$token}","UTF-8");
$new_attrs[] = new PHPTAL_Dom_Attr("language","","en","UTF-8");

$wrapper = new 
PHPTAL_Dom_Element("translation","",$new_attrs,$child->getXmlnsState());
$node->replaceChild($wrapper,$child);
$wrapper->appendChild($child);
...
}

Thank you in advance for any input.


Darrell Hamilton,
Software Developer,
4over, Inc
darre...@4over.com

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to