Skip to content

Commit

Permalink
Fix crash when language is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyEye-FAST committed Jan 28, 2024
1 parent 6ac71bb commit a229778
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

def get_locale():
"""语言选择器"""
return request.accept_languages.best_match(["zh", "en", "ja", "ru", "fr"])
locale = request.accept_languages.best_match(["zh", "en", "ja", "ru", "fr"])
if locale:
return locale
return "en"


def get_timezone_from_ip():
Expand Down

0 comments on commit a229778

Please sign in to comment.