On Wed, Jun 9, 2010 at 6:35 PM, daniel <[email protected]> wrote:
> Hello
>
> I'm working on an i18n project with pylons. I would need using _
> function from within routing.py
>
> If trying the following import into routing.py:
> from pylons.i18n.translation import _
>
> I get an error upon a browser request sending :
> TypeError: No object (name: translator) has been registered for this
> thread
>
> Apparentely there is some object missing at that stage
>
> Any help is greatly appreciated
>
I think that you can translate your urls at generation time:
mapper('blog', '/{lang}/{slug}', controller=''...)
Then in templates/python code:
from pylons.i18n import get_lang
url('blog', lang=get_lang(), slug=_(slug_var))
(dont remember if get_lang() return a string or a list of all accepted
languages)
--
Gael
> Daniel
>
> --
> 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.
>
>
--
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.