Flask Babel Translations path
... Some years later, get a clue in github . Since version 0.6, Babel seems to have poorly documented parameter BABEL_TRANSLATION_DIRECTORIES. Then the Flask app skeleton should be
# example.pyfrom flask import Flaskapp = Flask('example')# change path of messages.mo fileapp.config['BABEL_TRANSLATION_DIRECTORIES'] = 'i18n'# add translation capacityfrom flask.ext.babel import Babelbabel = Babel(app)# define routes and so on ...
With this configuration, Flask will look for translation first in dir 'i18n'.
A very basic jinja template
{{_('hello')}}
The directory tree with 2 languages. Files messages.po should contain translation of 'hello'
/myProject /i18n /en /LC_MESSAGES messages.po /fr /LC_MESSAGES messages.po example.py
Bonus : for multiple directories use
app.config['BABEL_TRANSLATION_DIRECTORIES'] = 'i18n;second_dir;third_dir'
The solution was to install Flask Babelex instead of Babel.
Why dont you just load the flask babel source into your project and modify it?