hey, it seems that Catalyst::Plugin::PageCache can NOT get along well
with the I18N.
to let the PageCache get along with languages, I patched the PageCache
for a bit.
sub _get_page_cache_key {
my ($c) = @_;
my $key = $c->next::method(@_);
my $langs = $c->languages();
$key .= '#' . join( '-', @$langs ) if ($langs);
return $key;
}
I have something like as follows in Root.pm sub auto
# internationalization
$c->stash->{lang} = $c->req->cookie('pref_lang')->value if
($c->req->cookie('pref_lang'));
$c->stash->{lang} ||= $c->user->lang if ($c->user_exists);
$c->stash->{lang} ||= $c->config->{default_pref_lang};
if (my $lang = $c->req->param('set_lang')) {
$lang =~ s/\W+//isg;
if (length($lang) == 2) {
$c->res->cookies->{pref_lang} = { value => $lang };
$c->stash->{lang} = $lang;
}
}
$c->languages( [ $c->stash->{lang} ] );
but it seems that sub dispatch { in PageCache.pm is called before
Root.pm sub auto.
so the $key = $c->_get_page_cache_key; in sub dispatch is different from
the $key in sub finalize.
any hints for suggestion are welcome. Thanks a lot.
--
Fayland Lam // http://www.fayland.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/