Sean Allen wrote: > > On Aug 25, 2008, at 11:22 PM, Stuart Johnston wrote: > >> Sean Allen wrote: >>> On Aug 25, 2008, at 9:53 PM, Stuart Johnston wrote: >>>> Your language files would look something like: >>>> >>>> [% BLOCK welcome %] >>>> Hello [% first_name %] >>>> [% END %] >>>> >>>> Your other templates would then include the blocks: >>>> >>>> [% PROCESS welcome %] >>>> >>>> So, this method is one-pass and all the templates are compile-cached. >>> I thought of this but we have use cases where we actually embed template >>> content up to 4 levels deep so that the first translation returns >>> content >>> that in return gets evaluated etc. >>> The one thing I like about the solution I came up with is it doesnt >>> require the template >>> user to know what is coming in the string. No need for having to know >>> if it needs >>> to be eval'd again or not. >>> Could something similar be achieved with Locale::Maketext? >>> I read through the cpan listing and I don't see anything to handle >>> that. Then again, >>> I used tt2 for 2 years and never noticed the eval filter. >> >> The Block method would handle this just fine. I suspect that Maketext >> would not. > > How would the block method handle? I'm just not seeing that. > Wouldn't the block method require you to know that first_name needs to > be eval'd again?
It is a standard feature of TT2. Templates and Blocks are evaluated recursively when you use PROCESS or INCLUDE. _______________________________________________ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates