1、设置搜索路径
caravel路径下:
vi babel.cfg:[ignore: static/assets/node_modules/**]
[python: **.py]
[jinja2: templates/**.html]
encoding = utf-8
2、生成翻译模板
pybabel extract -F babel.cfg -o messages.pot .
3、创建中文翻译
pybabel init -i messages.pot -d translations -l zh_CN
4、编写对应翻译
vi translations/zh_CN/LC_MESSAGES/messages.po
5、编译
pybabel compile -d translations
6、重启
ps aux|grep gunicorn|awk '{print $2}'|xargs kill -9nohup gunicorn -w 16 --timeout 60 -b 0.0.0.0:8018 caravel:app > /tmp/caravel.log 2>&1 &
学习自:http://blog.csdn.net/lichengtongxiazai/article/details/22270561