Hello all,

A long time ago I modified two, PHPTAL 1.1.16 library files to allow
expression chaining in i18n:translate. This allowed, for example:
<div class="error" i18n:translate="error | string:Invalid username or
password">Login error</div>
which means: translate the value of the error variable if that
variable is set, or translate the string "Invalid username or
password". The patches worked really well for PHPTAL 1.1.16, and were
quite useful is certain scenarios, so I decided to try and migrate the
changes to 1.2.0.

Attached are unified diffs (from v. 1.2.0) for the two files needing
modification: `PHPTAL/Php/Attribute/I18N/Translate.php` and
`PHPTAL/Php/Attribute/TAL/Content.php`. Basically, I tried to make the
same changes as before, but I noticed the new escape vs. stringify
feature, so I additionally incorporated changes in support of that.
(Is it just me, or shouldn't the second argument to
TranslationService::translate be deprecated?)

Feel free to try out the patches (license: Public Domain) and let me
know what you think.

Sincerely,

Daniel Trebbien.

Attachment: Content.php.diff
Description: Binary data

Attachment: Translate.php.diff
Description: Binary data

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

Reply via email to