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? - Back to caching, as I'm a little unclear when caching gets defeated: The method I came up with does a single pass. It just keeps eval'ing 'language' tags until they can't be eval'd anymore. How much gets cached? The block method, if you needed to select the block file dynamically like [% INCLUDE "/translations/${my_block_file}" %] how is the caching different? does it cache a compiled template for each different file that gets included? I thought that it would only cache that a block file needs to be pulled in. Or, is that what it does but each INCLUDEd file gets cached as well? _______________________________________________ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates