views:

24

answers:

1

Hello.

Just a quick question. When I use the _() function provided by the Pylons i18n module, everything works just as expected. My problem is with the lazy version of this function, lazy_gettext. When I run :

python setup.py extract_messages

I get in the POT file the strings to be translated with the _() function, but not those wuth lazy_gettext(). How may I get it to work ?

Thanks.

+2  A: 

In the modules where you use lazy_gettext(), just assign _ = lazy_gettext and use _() instead.

Ignacio Vazquez-Abrams
Can't you just call `unicode()` against the ones you want to evaluate immediately?
Ignacio Vazquez-Abrams
Yep, thank you. But im my case, I need the two versions in the same module. I'll think about it.I found another solution, which is to run `python setup.py extract_messages --keywords lazy_gettext` instead of the other one. But is there a "nicer" way to fix this ?
Pierre
Yep, why not. Didn't think about this workaround.It will do the job. Not really optimized through :)
Pierre