[html-formfu] Catalyst: FormFu localisation doesn't work, templates & controllers localisation do

Jan Grmela jan.grmela at imakers.cz
Tue Jul 17 14:07:16 GMT 2012


Hi there,
I'm just in process of implementation translations to our new app.
We're using Catalyst with Catalyst::Controller::HTML::FromFu and
Template Toolkit as a templating engine along with
Catalyst::Plugin::I18N to localize our app.

The base translation is done using a plain strings (not translation
keys). So for "Sign In", we've got in the cs.po file "Přihlásit se"
(in Czech).

The problem we have is the template & controlller translation work
fine (the text after and before the form is translated) but we can't
make FormFu to use the non-english translated file.

=========
Our config:
=========
'Controller::HTML::FormFu' =>  {
		constructor => {
            			render_method	=> 'tt',
			tt_args => {
				ENCODING => 'UTF-8'
			}
		},
		languages_from_context  => 1,
		localize_from_context   => 1,
},

=========
Test form:
=========
---
method: post
id: login_form
auto_constraint_class: constraint_%t
elements:
 - type: Text
   label_loc: Sign In
   name: test
   constraints:
   - type: Required
 - type: Submit
   name: submit_btn
   value_loc: Sign In
   add_attributes_xml:
     class: button right

filter:
 - TrimEdges
 - HTMLEscape

=========
Translation file
=========
...
msgid "Sign In"
msgstr "Přihlásit se"
...

Even if we do $form->languages(['cs']) manually and then process the
form (along with some other code as suggested at
http://lists.scsys.co.uk/pipermail/html-formfu/2009-October/002521.html)
only the original texts are still loaded.

The languages method before manual setting returns 'en', afterwards
the output is changed to 'cs' but the $form->{localize_data} still
contains the same data:
{
	'dies_on_missing_key' => 1,
	'localize_object' => bless( {
		'_external_lex_cache' => {}
	}, 'HTML::FormFu::I18N::en' )
}

How can I make the form translation work? The language doesn't seem to
be set correctly -- I've even tried setting it to Italian which have
already translated form error strings in F::I18N::it and they're still
displayed in English.

-- 
Jan Grmela
jan.grmela at imakers.cz
+420 608 110 686

iMakers, s.r.o.
Absolonova 725/81, Brno, 62400, Czech Republic

ICO/Id: 29228875
DIC/VAT No: CZ29228875



More information about the HTML-FormFu mailing list