[Catalyst] Problem using Catalyst::Plugin::I18N and Catalyst::Plugin::PageCache

Larry Leszczynski larryl at emailplus.org
Wed Feb 4 23:47:29 GMT 2009


Hi all -

I have two problems that I think are related, I think I may just be
missing something simple...

First, I'm having trouble getting Catalyst::Plugin::I18N to use a
specific language (grabbed from user preferences).  Inside
MyApp::Controller::Root::auto() I am doing this:

    $c->log->debug('$c->languages from auto-detect: ' .
    dump($c->languages));
    $c->log->debug('$c->language: ' . $c->language);

    $c->log->debug('Setting language to "en"...');
    $c->languages(['en']);

    $c->log->debug('$c->languages: ' . dump($c->languages));
    $c->log->debug('$c->language: ' . $c->language);

which results in this:

    [debug] $c->languages from auto-detect: ["en-us", "en", "i-default"]
       (this looks right based on my browser settings)

    [debug] $c->language: i_default
       (why does it pick "i-default" instead of "en-us" or "en"?)

    [debug] Setting language to "en"...
    [debug] $c->languages: ["en"]
       (this looks right)

    [debug] $c->language: i_default
       (I expected "en" here)

Am I doing something wrong?

Next problem has to do with C::P::PageCache - it uses $c->language
internally when generating page cache keys, so my page cache keys always
have "i_default" in them.  I'm guessing it has to do with the problem
above...

I am using Catalyst 5.8000_04 and the following plugin versions (which I
think are all up-to-date):

    Catalyst::Plugin::I18N  0.08
    Catalyst::Plugin::PageCache  0.21
    Catalyst::Plugin::Unicode  0.8

Any help much appreciated.

Thanks!
Larry



More information about the Catalyst mailing list