Pyramid + forms + i18n

88 views
Skip to first unread message

pigmej

unread,
Mar 17, 2011, 10:12:13 AM3/17/11
to pylons-discuss
Hey everyone,

I'm currently fighting with pyramid + *any* form library that can do
i18n...

Is there any working example of that ?

I'm using Mako templates so I don't want to use Deform.

I tried with pyramid_simpleforms but I cannot get the error messages /
labels etc translated.
I tried also with WTForms and their *new* .gettext() method in form -
but I have no idea how to get correct .gettext and .ugettext (tried
with TranslationStringFactory and Translations).

Naturally I'm trying to define the forms in forms.py to avoid building
form on each request.

Thanks,

Daniel Holth

unread,
Mar 17, 2011, 2:56:41 PM3/17/11
to pylons-...@googlegroups.com
I don't see anything wrong with it, but a number of people seem to have a philosophical objection to using a forms library that renders itself with a different templating language than the rest of the web page. It is also possible but time consuming to replace the deform templates with some other templating language...

Using deform with jinja2:

{{ form.render() | safe }}

Using deform with Chameleon:

<div tal:replace="structure form.render()"/>

Using deform with Mako:

${ form.render() | n }
Reply all
Reply to author
Forward
0 new messages