Change language Flask Babel manually Change language Flask Babel manually flask flask

Change language Flask Babel manually


A good way to do this is shown in the docs of Flask-Admin

@babel.localeselectordef get_locale():    if request.args.get('lang'):        session['lang'] = request.args.get('lang')    return session.get('lang', 'en')

Now, you could try a French version of the application at: http://localhost:5000/admin/?lang=fr.

You can still specify the default language via BABEL_DEFAULT_LOCALE.