/codewow

explore & share your baby code

Primary LanguagePython

codewow startup now

# 安装
mongodb

pip install ...
flask
flask-mongoalchemy
flask-principal
flask-wtf
flask-openid
flask-script
flask-babel
blinker
gevent
supervior # 运行管理

# 国际化
$vi  babel.cfg
[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_

$ pybabel extract -F babel.cfg -o messages.pot .
# if you use lazy_gettext()
$ pybabel extract -F babel.cfg -k lazy_gettext -o messages.pot .

# mapping to your lang  create the first translation
$ pybabel init -i messages.pot -d translations -l zh
-d translations tells pybabel to store the translations in this folder.
This is where Flask-Babel will look for translations.
Put it next to your template folder.

To compile the translations for use, pybabel helps again:
$ pybabel compile -d translations

What if the strings change? Create a new messages.pot like above and then let pybabel merge the changes:
$ pybabel update -i messages.pot -d translations

TODO:
搜索 # done simple mongo full text search
代码拷贝
上传头像
分享到SNS
下载文件接口