fava: support flask-babel 3

This commit is contained in:
Nick Cao 2023-02-03 17:29:01 +08:00
parent 89fae351e4
commit 5545f930a2
No known key found for this signature in database
2 changed files with 22 additions and 1 deletions

View File

@ -10,7 +10,14 @@ python3.pkgs.buildPythonApplication rec {
sha256 = "sha256-Uw8UIJa+Dtsy+o31I1ynLyhZrFNX42NFRXu1O2ISbzU=";
};
pythonRelaxDeps = [ "cheroot" ];
patches = [
./flask-babel.patch
];
pythonRelaxDeps = [
"cheroot"
"Flask-Babel"
];
nativeBuildInputs = with python3.pkgs; [ setuptools-scm pythonRelaxDepsHook ];

View File

@ -0,0 +1,14 @@
diff --git a/src/fava/application.py b/src/fava/application.py
index 811c1de4..19de051a 100644
--- a/src/fava/application.py
+++ b/src/fava/application.py
@@ -148,8 +148,7 @@ def get_locale() -> str | None:
return request.accept_languages.best_match(["en"] + LANGUAGES)
-BABEL = Babel(app)
-BABEL.localeselector(get_locale)
+BABEL = Babel(app, locale_selector=get_locale)
for function in template_filters.FILTERS: