1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 12:30:00 +00:00

Handle version 3.0 of flask-babel

This commit is contained in:
Ozzie Isaacs 2023-01-22 12:09:19 +01:00
parent c21a870b8e
commit 94a6931d48
3 changed files with 9 additions and 8 deletions

View File

@ -36,7 +36,7 @@ from .reverseproxy import ReverseProxied
from .server import WebServer from .server import WebServer
from .dep_check import dependency_check from .dep_check import dependency_check
from .updater import Updater from .updater import Updater
from .babel import babel from .babel import babel, get_locale
from . import config_sql from . import config_sql
from . import cache_buster from . import cache_buster
from . import ub, db from . import ub, db
@ -156,8 +156,11 @@ def create_app():
app.secret_key = os.getenv('SECRET_KEY', config_sql.get_flask_session_key(ub.session)) app.secret_key = os.getenv('SECRET_KEY', config_sql.get_flask_session_key(ub.session))
web_server.init_app(app, config) web_server.init_app(app, config)
if hasattr(babel, "localeselector"):
babel.init_app(app) babel.init_app(app)
babel.localeselector(get_locale)
else:
babel.init_app(app, locale_selector=get_locale)
from . import services from . import services

View File

@ -9,8 +9,6 @@ log = logger.create()
babel = Babel() babel = Babel()
@babel.localeselector
def get_locale(): def get_locale():
# if a user is logged in, use the locale from the user settings # if a user is logged in, use the locale from the user settings
user = getattr(g, 'user', None) user = getattr(g, 'user', None)

View File

@ -1,7 +1,7 @@
APScheduler>=3.6.3,<3.10.0 APScheduler>=3.6.3,<3.10.0
werkzeug<2.1.0 werkzeug<2.1.0
Babel>=1.3,<3.0 Babel>=1.3,<3.0
Flask-Babel>=0.11.1,<2.1.0 Flask-Babel>=0.11.1,<3.1.0
Flask-Login>=0.3.2,<0.6.3 Flask-Login>=0.3.2,<0.6.3
Flask-Principal>=0.3.2,<0.5.1 Flask-Principal>=0.3.2,<0.5.1
backports_abc>=0.4 backports_abc>=0.4
@ -11,10 +11,10 @@ PyPDF>=3.0.0,<3.3.0
pytz>=2016.10 pytz>=2016.10
requests>=2.11.1,<2.28.0 requests>=2.11.1,<2.28.0
SQLAlchemy>=1.3.0,<1.5.0 SQLAlchemy>=1.3.0,<1.5.0
tornado>=4.1,<6.2 tornado>=4.1,<6.3
Wand>=0.4.4,<0.7.0 Wand>=0.4.4,<0.7.0
unidecode>=0.04.19,<1.4.0 unidecode>=0.04.19,<1.4.0
lxml>=3.8.0,<5.0.0 lxml>=3.8.0,<5.0.0
flask-wtf>=0.14.2,<1.1.0 flask-wtf>=0.14.2,<1.2.0
chardet>=3.0.0,<4.1.0 chardet>=3.0.0,<4.1.0
advocate>=1.0.0,<1.1.0 advocate>=1.0.0,<1.1.0