Re: [SMARTY] using gettext with smarty
| From: | Peter Bowyer | Date: | Sun, 16 Mar 2003 14:13:43 +0000 |
| Subject: | Re: [SMARTY] using gettext with smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8675@lists.php.net to get a copy of this message | ||
At 20:22 13/03/2003 -0500, James E. Flemer wrote:
The problem is that functions have to look like:
{gettext msg="Smarty is fine with this."} or even
{_ _="Smarty is fine with this."} or
{"This is ok, too."|gettext} etc.
If I use something that Smarty likes, then the gettext tools
don't work (to extract the message catalog). Does anyone have
suggestions, or better yet something already implemented? I'd
rather do this with a plugin, tho modifying Smarty is an option.
One way would be to use a prefilter to convert those latter two types to the necessary PHP code. Although I think this would mean having Smarty set to allow PHP code in your templates which may/may not be a security risk in your case. I think this would be necessary as the compiler would see PHP code. I can't actually remember though - it's been such a long time since I used Smarty for anything like this.
[going OT: I personally feel that Smarty has recently crossed that complexity barrier from a templating system to a templating and scripting language. Things I see people trying to do with it really should be done with PHP itself. All we need now is to rewrite Smarty in lex/bison to complete the transistion. Not that I'm saying Smarty is bad - it's a brilliant macro language that speeds up + simplifies PHP development. It's just not a pure templating system any more]
Peter.
--
Narrow Gauge Heaven - news, photos, railway directory and discussion forums!
http://www.narrow-gauge.co.uk
Glenbranter - Scottish narrow gauge in 009
http://glenbranter.narrow-gauge.co.uk