On 02.04.2010, at 14:20, Florent wrote: > > I know that phptal i18n gettext implementation is fetching translations > at run time. > Performance-wise, it would be interesting to fetch translations at parse > time and cache one compiled template per locale. > Some workaround would be needed for plural translation, probably some > generated > code based on the plural form defined in PO files. > My question : > >> From where would you start in phptal code to change this behavior? > > How can I hook into i18n namespace and implement my own modifier?
It's doable. You'd have to change PHPTAL code to translate text immediately where possible – search for code that generates translate() calls and make it generate constant strings. And you'd have to change caching to cache each language separately (tweak in PHPTAL::getFunctionName() should suffice). However, you'd also need to add some efficient way to figure out when translation files were updated or PHPTAL would never see need to recompile templates with new text. I don't know how to do that efficiently for gettext() without making updates error-prone (it's bad enough already that Apache needs restart). -- regards, Kornel _______________________________________________ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal