How To Configure My Python 2.7 To Use The Correct Babel Installation On My Osx Mavericks System?
Solution 1:
I tried setting the PYTHONPATH but made a mistake ...
I created a symbolic link in the egg archive pybabel was using to the localedata/ in the MacPorts version and it seems to have worked :
> cd /Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel> ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/babel/localedata localedata
ln: localedata: Permission denied
> sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/babel/localedata localedata
Password:
>
If someone has better suggestions or advices, please leave a comment or another answer. Thank you.
[follow-up 2014-01-09]--------------------------------------------------------------------------------------------------------------
I still could not get the "{% trans %}" tags translated, I found here that you need to explicitly use the -F option on pybabel like that (even if the babel.cfg file is in the current directory!):
> pybabel -v extract -F babel.cfg -o ./locale/messages.pot ./
And to help here is the content of my babel.cfg file :
[jinja2: **/templates/**.html]encoding = utf-8[python: python/*.py][extractors]jinja2 = jinja2.ext:babel_extract
But I got "ImportError: No module named ..." error messages because I did not have jinja2 and markupsafe properly configured. So, I added two symlinks :
> sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jinja2 /Library/Python/2.7/site-packages/jinja2> sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/markupsafe /Library/Python/2.7/site-packages/markupsafe
And it finally worked! I got the content of the "{% trans %}" tags in my messages.pot file!
Yet, I wonder if it is he best solution ...
Post a Comment for "How To Configure My Python 2.7 To Use The Correct Babel Installation On My Osx Mavericks System?"