Extracting Translation string from .py files.

29 views
Skip to first unread message

Gerhard Schmidt

unread,
Mar 30, 2015, 3:27:45 AM3/30/15
to pylons-...@googlegroups.com
Hi,

i developing a pyramid application with i18n support. I've setup pyramid
to use lingua and as far as I user i18n tag in chameleon templates
pot-create extracting them correctly.

But translation strings from python code is not extracted.

I am following the documentation at
http://docs.pylonsproject.org/docs/pyramid/en/latest/narr/i18n.html


error_notaicalfile = TranslationString("The given Address didn't return
a calendar file", domain='eventbroker')

and in the view i use

request.localizer.translate(error_notaicalfile)

Am I doing something wrong.

Regards
Estartu


--
---------------------------------------------------------------------------
Gerhard Schmidt | http://www.augusta.de/~estartu |
Fischbachweg 3 | | PGP Public Key
86856 Hiltenfingen | JabberID: est...@augusta.de | on request
Germany | |


signature.asc

Thierry Florac

unread,
Mar 30, 2015, 4:20:09 AM3/30/15
to pylons-...@googlegroups.com
Hi,
Did you tried using the TranslationStringFactory instead?
from pyramid.i18n import TranslationStringFactory
_ = TranslationStringFactory('eventbroker')
...
error_notaicalfile = _("The given Address didn't return...")
request.localizer.translate(error_notaicalfile)
I use this method with lingua and it works perfectly...

Best regards,
Thierry

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages