Re: Creating template from string

Bruno Postle <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
On Thu 21-Jul-2005 at 09:42 +0100, Mark Holland wrote:
> 
> I agree this would be a good feature to have. We are hoping to, in
> the near future, create an I18N preprocessor, which will
> pre-process and populate any i18n:translate tags which do not
> contain i18n:name tags. 

Are you using I18NFool?  This is the framework we built for
internationalising Petal templates:

  http://search.cpan.org/dist/I18NFool/

(yeah stupid name, I know)

The Petal::I18N documentation is a little out-of date in this
respect:

  http://search.cpan.org/dist/Petal/lib/Petal/I18N.pm

> The idea is to cache per-language versions of each template (maybe
> using Cache::FileCache) which can be read into Petal for normal
> compilation and processing. So being able to construct a template
> from a string could be useful.

Petal already caches templates seperately for each language.  This
was buggy until recently, but it should be ok now.

> One thought though - how will Petal cache the complied version of
> a template created from a string? Perhaps some sort of 'cache key'
> could be passed to the constructor?

This is tricky, it needs to be persistent between processes.

-- 
Bruno
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.