[html-formfu] Setting the current language

Octavian Râşniţă orasnita at gmail.com
Thu Oct 15 10:52:43 GMT 2009


Hi Carl,

From: "Carl Franks" <fireartist at gmail.com>
2009/10/14 Octavian Râşniţă <orasnita at gmail.com>:
> Hi,
>
> I have seen that if I add in a form configuration file (Config::General
> type):
>
> languages fr
>
> then French becomes the current language for localising the error 
> messages.
> But I don't know how to set that language dynamicly - from the program.
>
> I have tried:
>
> my $form = $c->stash->{form};
> $form->languages(['fr']);
>
> I have also tried to add $form->process; but nothing happends. The default
> language still remains English.

Hi,
If you set this in your config, it should automatically pick up
Catalyst's current setting.

'Controller::HTML::FormFu':
  languages_from_context: 1

I've seen that it works by using
localize_from_context => 1,

and I also needed to add
constructor => {
localize_class => 'Catalyst::Plugin::I18N::DBI',
},

Thank you.

Octavian




More information about the HTML-FormFu mailing list