On Wed, Mar 28, 2012 at 12:15 PM, tonthon <[email protected]> wrote:

> Hi,
>
> I'm trying to get translated messages while using deform (I'm working on
> a french-only application).
>
> I've added :
> """
> pyramid.default_locale_name = fr
> """
> to my application inifile.
>
> I've added :
> """
> config.add_translation_dirs('deform:locale')
> """
> to my application __init__.py.
>
> But it doesn't seem to be sufficient.
>
> I've tried launching the following one from within one of my views :
> """
> from pyramid.i18n import
> TranslationStringFactory
> from pyramid.i18n import
> get_localizer
>
>
> translater =
> TranslationStringFactory('deform')
>
> def _(request, string,
> mapping=None):
>     ts = translater(string,
> mapping)
>     localizer =
> get_localizer(request)
>     return localizer.translate(ts)
>
> def myview(request):
>     print _(Required)
>     ...
> """
> and it prints "Requis" as expected. I can consider my setup is fine, but
> I can't understand why deform messages are still in english.
>
> How should I do to make deform render translated strings ?
>
> Regards,
> Gaston
>
>
deform has nothing to do with pyramid or its translation hooks.  You need
to pass deform a renderer with a translator as well with:

 deform.Form.set_default_renderer(renderer)

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to