Bruno Postle | 10 Mar 19:00
X-Face

[BUG] translated fragments get cached in last accessed language

This is a Petal bug.  Basically if I enable the Petal cache and do 
something like this:

  my $a = new Petal (file => 'foo', base_dir => 'bar', language => 'en');
     $a = new Petal (file => 'foo', base_dir => 'bar', language => 'fr');

..Petal continues to use 'en' templates.

Either the memory or disk cache will cause the problem, which 
explains why Chris was having to both restart apache and delete the 
petal_cache_* files.

I don't really have the time to track this down just now (new baby 
etc..), so I've added some tests that demonstrate the problem to 
Petal CVS:

  http://lists.webarch.co.uk/pipermail/mkdoc-commit/2005-March/000722.html

On Wed 23-Feb-2005 at 17:35 +0000, Chris Croome wrote:
> On Wed 23-Feb-2005 at 05:19:22PM +0000, Chris Croome wrote:
> > 
> > With MKDoc 1.4 you could havea directory like /bread-crumb-trail/
> > with a en.html and a tr.html file in it and on Turkish pages the
> > tr.html template would be used and on English pages the en.html
> > fragment would be used.
> > 
> > This is broken in MKDoc 1.6.
> > 
> > What happens is that the *first* language version to be accessed
> > appears to be cached and then pages of either language just
(Continue reading)

Chris Croome | 10 Mar 22:45
Picon
Favicon

Re: [BUG] translated fragments get cached in last accessed language

Hi

On Thu 10-Mar-2005 at 06:00:53PM +0000, Bruno Postle wrote:
> This is a Petal bug. 

Ahh, nice one on tracking it down... I updated the bug page:

  http://www.mkdoc.org/bugs/stable/normal/translated-template-fragments/

If we ever have to do another site with translated templates using
1.6 then this is worth fixing -- the fix would probably be less work
than creating the templates needed to work around the fix... However
since there is no way to easily translate the templates with 1.6 I'd
much rather do any site that needs translated templates with 1.8...

Chris

--

-- 
Chris Croome                               <chris@...>
web design                             http://www.webarchitects.co.uk/ 
web content management                               http://mkdoc.com/   
Bruno Postle | 11 Mar 15:42
X-Face

Re: [BUG] translated fragments get cached in last accessed language

On Thu 10-Mar-2005 at 18:00 +0000, Bruno Postle wrote:

> This is a Petal bug.  Basically if I enable the Petal cache and do 
> something like this:
>
>   my $a = new Petal (file => 'foo', base_dir => 'bar', language => 'en');
>      $a = new Petal (file => 'foo', base_dir => 'bar', language => 'fr');
>
> ..Petal continues to use 'en' templates.

The problem was that Petal hard-codes paths and languages for 
included templates in the cached code - Whichever language the 
template was using when it was first-run is the language that gets 
used from then-on.

The attached patch fixes this by stirring the 'language' into the 
hash key used to store and retrieve the cached code.  I would 
appreciate it if somebody could look-over it before I commit and 
release.

--

-- 
Bruno
Index: lib/Petal.pm
===================================================================
RCS file: /var/spool/cvs/Petal/lib/Petal.pm,v
retrieving revision 1.126
diff -r1.126 Petal.pm
609c609
(Continue reading)

William McKee | 14 Mar 16:04
Favicon

Re: [BUG] translated fragments get cached in last accessed language

On Fri, Mar 11, 2005 at 02:42:04PM +0000, Bruno Postle wrote:
> The attached patch fixes this by stirring the 'language' into the 
> hash key used to store and retrieve the cached code.  I would 
> appreciate it if somebody could look-over it before I commit and 
> release.

Bruno,

This looks like a good solution to me.

BTW, what's the status of i18n support in Petal these days? I notice
that the Petal::I18N module clearly marks it as beta by the
description--"Attempt at implementing ZPT I18N for Petal". I haven't
needed it yet but have seen some folks asking about engines that support
it and would love to recommend our project.

William

--

-- 
Knowmad Services Inc.
http://www.knowmad.com

Chris Croome | 14 Mar 16:22
Picon
Favicon

Re: [BUG] translated fragments get cached in last accessed language

Hi

On Mon 14-Mar-2005 at 10:04:10AM -0500, William McKee wrote:
> 
> BTW, what's the status of i18n support in Petal these days? I
> notice that the Petal::I18N module clearly marks it as beta by the
> description--"Attempt at implementing ZPT I18N for Petal". I
> haven't needed it yet but have seen some folks asking about
> engines that support it and would love to recommend our project.

It's fine I think, I have almost added i18n attributes to all the
MKDoc 1.8 templates and we are using i18nFool for generating .po
files:

  http://search.cpan.org/~bpostle/I18NFool-0.31/lib/I18NFool.pm

And there are some instructions here for working with .po files:

  http://www.mkdoc.org/docs/howto/translate/

What we haven't yet done is deploy MKDoc 1.8 for a production site
with translated templates so although I think it all works OK I'm
not 100% sure :-)

Chris

--

-- 
Chris Croome                               <chris@...>
web design                             http://www.webarchitects.co.uk/ 
web content management                               http://mkdoc.com/   
(Continue reading)


Gmane