Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default language when Accept-Language header is '*' #3724

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion aleph/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@
def determine_locale():
try:
options = SETTINGS.UI_LANGUAGES
locale = request.accept_languages.best_match(options)
if str(request.accept_languages) == "*":
# For #3704: if any language is fine pick the default one
locale = SETTINGS.DEFAULT_LANGUAGE
else:
locale = request.accept_languages.best_match(
options, default=SETTINGS.DEFAULT_LANGUAGE
)
locale = locale or str(babel.default_locale)
except RuntimeError:
locale = str(babel.default_locale)
Expand Down
Loading