Re: [htmltmpl] Re: language support
Brought to you by:
samtregar
From: Sam T. <sa...@tr...> - 2004-10-29 15:56:59
|
On Fri, 29 Oct 2004, Peter Valdemar M=F8rch wrote: > I use gettext, and so I've created this filter: >=20 > my $gettextFilterSub =3D sub { > my ($text_ref) =3D @_; > $$text_ref =3D~ > s/<gettext\(\"([^\"]*)\"\)>/gettext($1)/ge; # To satisify xgettext: " > }; You could also use HTML::Template::Expr and setup a function called gettext: <tmpl_var expr=3D"gettext('Hello World')"> It's more verbose but it will work better with the cache system. If you want your syntax you could combine the two: my $gettextFilterSub =3D sub { my ($text_ref) =3D @_; $$text_ref =3D~ s/<(gettext\([^)]\))>/<tmpl_var expr=3D$1>/g; }; -sam |