https://python-babel.github.io/flask-babel/
pip install Flask-Babel
Create /translations directory at the root of the project
Create /lg directory for each supported language (e.g. /en, /fr,…)
Create /LC_MESSAGES folder under each supported language
[jinja2: templates/**.html]
[python: **.py]
pybabel extract -F babel.cfg -o messages.pot .
It creates a messages.pot file
pybabel init -i messages.pot -d translations -l fr
Note: if you want to later update the .po file after creating a new messages.pot file
pybabel update -d translations -i messages.pot -l fr
Then translate all the msgid entries in the .po file as msgstr
You can give the full content to ChatGPT and ask it to generate the translations.
pybabel compile -d translations
from flask_babel import Babel, _,lazy_gettext as _l, gettext
Follow the instructions for the full configuration.