Search code examples
pythonflaskinternationalizationpython-babelflask-babel

Flask-Babel not translating with Pluggable Views


I am trying to get Flask-Babel to work with Pluggable Views. Although the @babel.localeselector annotated function gets called as expected, translation is not actually occurring.

I have set up a demo repo of my problem on GitHub: https://github.com/legeorges/flask-babel

We should be seeing "Hello" instead of "Bonjour" for the index page that uses a template and for the /hello page that just returns a String

There is a working sample app called simple-babel, however it uses Blueprint instead of Pluggable Views.


Solution

  • Your translations folder should be under app folder!!

    I met the same problem..