On Jun 26, 2006, at 2:17 AM, Laurent Vasseur wrote:
> Is it possible to use pylons i18n in an external module ? When I try to
> use h._ outside of a server context, I get this error:
>
>>>> from pylons import h
>>>> h._
> <bound method Helpers._ of <pylons.util.Helpers object at 0x00DE1FB0>>
>>>> h._('test')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "c:\pylons\pylons\util.py", line 164, in _
> return self.__dict__['_local'].translator.gettext(value)
> File "c:\pylons\pylons\util.py", line 57, in __getattr__
> result = self._local.request.get(name, '')
> AttributeError: 'thread._local' object has no attribute 'request'
At the moment, it's not possible to use the h object outside of a
Pylons request environment. For translations in external modules not
using Pylons, askel's solution would probably be best.
HTH,
Ben
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---