python-babel / flask-babel

i18n and l10n support for Flask based on Babel and pytz
https://python-babel.github.io/flask-babel/
Other
432 stars 159 forks source link

Translations not updated while server is running #180

Closed alhman closed 3 years ago

alhman commented 3 years ago

Hi,

when I change a translation in the .po file and then compile the messages with pybabel compile the translations are not updated in the application until I stop and restart the flask server (flask run).

With Flask-Babel 1.0.0 this worked perfectly fine (i.e. no server restart necessary) and only occurs with 2.0.0

TkTech commented 3 years ago

https://flask.palletsprojects.com/en/1.1.x/cli/#watch-extra-files-with-the-reloader

This worked before because flask-babel was reloading the .mo files on each request, which is just terrible.

alhman commented 3 years ago

Thanks! This makes sense. Did reloading on each request in previous flask-babel occur only in development mode or also in production?

Using the latest version and setting FLASK_RUN_EXTRA_FILES in development mode works fine. Would it make sense to add a short note about reloading in the documentation?

TkTech commented 3 years ago

It occurred always. It was one of the reasons Flask-BabelEx existed.

A PR adding documentation would be welcomed.