Remove use of deprecated before_first_request decorator (#1162)

This commit is contained in:
Daniel Markstedt 2023-05-01 19:21:17 -07:00 committed by GitHub
parent cfcfbc4301
commit 09d0598c2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -1369,15 +1369,16 @@ def healthcheck():
return "", 200
@APP.before_first_request
@APP.before_request
def detect_locale():
"""
Get the detected locale to use for UI string translations.
This requires the Flask app to have started first.
"""
session["language"] = get_locale()
piscsi_cmd.locale = session["language"]
file_cmd.locale = session["language"]
if "language" not in session.keys():
session["language"] = get_locale()
piscsi_cmd.locale = session["language"]
file_cmd.locale = session["language"]
@APP.before_request