[html-formfu] Localization with catalyst

Gabor HALASZ halasz.g at freemail.hu
Fri Jan 29 11:42:28 GMT 2010


Hi!

I tried localize formfu with catalyst::plugin::I18N, but I have no luck. 
The c-p-I18N configured and works via template toolkit. I added next 
lines (found in a list archive) to lib/MyApp.pm:

__PACKAGE__->config(
...
     'Controller::HTML::FormFu' => {
         constructor     => {
             localize_class      => 'Catalyst::Plugin::I18N',
             render_method       => 'tt',
             },
         languages_from_context  => 1,
         localize_from_context   => 1,
         },
...

Created a simple controller:

sub login :Chained('base') :PathPart('login') :Args(0) :FormConfig {
     my ($self, $c) = @_;
     my $form = $c->stash->{form};

#$c->log->debug ('CheckPoint: ' . Dumper $form);
$c->log->debug ('Form->languages: ' . join (' ', @{$form->languages}));
$c->log->debug ('Form->localize_class: ' . $form->localize_class);

     if ($form->submitted) {
         if (! $form->has_errors) {
             $c->response->redirect ($c->uri_for ('/'));
         }
     }
     $c->stash->{template}       = 'auth/login.tt';
}

I created a simple template ([% form %]). Everything works, except the 
form localization (my page is localized, my language files contains the 
words of form, the form displayed and works, etc...). The debug messages:

[debug] Catalyst::Controller::HTML::FormFu::Action::FormConfig loading 
config file 'auth/login'
[debug] Form->languages: hu en ru en-us i-default
[debug] Form->localize_class: Catalyst::Plugin::I18N
[debug] Rendering template "auth/login.tt"

My packages' versions:

HTML-FormFu-0.06001_1
Catalyst-Plugin-I18N-0.09
Catalyst-Runtime-5.80017


What's my mistake? Any idea?

ps

Sorry for my english...

-- 
Gabor HALASZ <halasz.g at freemail.hu>



More information about the HTML-FormFu mailing list