I'm adding language translation support to my project. The code is on Python and has jinja2 in the html files, and Javascript.
I'm trying to use Babel to do the translation, but it doesn't recognize the extraction method of jinja2. Maybe I'm using an incorrect name for it.
This is my ini file:
# Extraction from Python source files
[python: **.py]
# Extraction from Jinja2 template files
[jinja2: **.html]
# Extraction from JavaScript files
[javascript: **.js]
extract_messages = $._, jQuery._
And this is the error I receive;
C:\>python Babel-0.9.6/babel/messages/frontend.py extract --project=GV --version=1 --no-location -o locale\messages.pot -F babel.ini frontend te
mplates
extracting messages from frontend\__init__.py
INFO:babel:extracting messages from frontend\__init__.py
...
Traceback (most recent call last):
File "Babel-0.9.6/babel/messages/frontend.py", line 1208, in <module>
main()
File "Babel-0.9.6/babel/messages/frontend.py", line 1107, in main
return CommandLineInterface().run(sys.argv)
File "Babel-0.9.6/babel/messages/frontend.py", line 651, in run
return getattr(self, cmdname)(args[1:])
File "Babel-0.9.6/babel/messages/frontend.py", line 912, in extract
for filename, lineno, message, comments in extracted:
File "c:\Python27\lib\site-packages\babel-0.9.6-py2.7.egg\babel\messages\extract.py", line 172, in extract_from_dir
strip_comment_tags):
File "c:\Python27\lib\site-packages\babel-0.9.6-py2.7.egg\babel\messages\extract.py", line 202, in extract_from_file
strip_comment_tags))
File "c:\Python27\lib\site-packages\babel-0.9.6-py2.7.egg\babel\messages\extract.py", line 271, in extract
raise ValueError('Unknown extraction method %r' % method)
ValueError: Unknown extraction method 'jinja2'
Press any key to continue . . .
Any ideas? Thanks, Gadi