1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
diff --git a/cps/__init__.py b/cps/__init__.py
index d9980778c..9d8cfa925 100644
--- a/cps/__init__.py
+++ b/cps/__init__.py
@@ -36,7 +36,7 @@
from .server import WebServer
from .dep_check import dependency_check
from .updater import Updater
-from .babel import babel
+from .babel import babel, get_locale
from . import config_sql
from . import cache_buster
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))
web_server.init_app(app, config)
-
- babel.init_app(app)
+ if hasattr(babel, "localeselector"):
+ babel.init_app(app)
+ babel.localeselector(get_locale)
+ else:
+ babel.init_app(app, locale_selector=get_locale)
from . import services
diff --git a/cps/babel.py b/cps/babel.py
index 4da808bc7..5a6136a55 100644
--- a/cps/babel.py
+++ b/cps/babel.py
@@ -9,8 +9,6 @@
babel = Babel()
-
-@babel.localeselector
def get_locale():
# if a user is logged in, use the locale from the user settings
user = getattr(g, 'user', None)
diff --git a/requirements.txt b/requirements.txt
index ba37df7e4..04941f302 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
APScheduler>=3.6.3,<3.10.0
werkzeug<2.1.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-Principal>=0.3.2,<0.5.1
backports_abc>=0.4
@@ -11,10 +11,10 @@ PyPDF>=3.0.0,<3.3.0
pytz>=2016.10
requests>=2.11.1,<2.28.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
unidecode>=0.04.19,<1.4.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
advocate>=1.0.0,<1.1.0
|