mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-12-22 23:26:31 +00:00
Merge pull request #434 from misuzu/flask-babel-3-compat
Fix compatibility with flask-babel v3
This commit is contained in:
commit
90f1fa9b41
2 changed files with 4 additions and 3 deletions
|
@ -1079,14 +1079,15 @@ def create_app(args):
|
|||
return jsonify(lazy_swag(swag))
|
||||
|
||||
app.config["BABEL_TRANSLATION_DIRECTORIES"] = 'locales'
|
||||
babel = Babel(app)
|
||||
@babel.localeselector
|
||||
|
||||
def get_locale():
|
||||
override_lang = request.headers.get('X-Override-Accept-Language')
|
||||
if override_lang and override_lang in get_available_locale_codes():
|
||||
return override_lang
|
||||
return session.get('preferred_lang', request.accept_languages.best_match(get_available_locale_codes()))
|
||||
|
||||
babel = Babel(app, locale_selector=get_locale)
|
||||
|
||||
app.jinja_env.globals.update(_e=gettext_escaped, _h=gettext_html)
|
||||
|
||||
# Call factory function to create our blueprint
|
||||
|
|
|
@ -3,7 +3,7 @@ Flask==2.2.2
|
|||
flask-swagger==0.2.14
|
||||
flask-swagger-ui==4.11.1
|
||||
Flask-Limiter==2.6.3
|
||||
Flask-Babel==2.0.0
|
||||
Flask-Babel==3.1.0
|
||||
Flask-Session==0.4.0
|
||||
waitress==2.1.2
|
||||
expiringdict==1.2.2
|
||||
|
|
Loading…
Reference in a new issue