Skip to content

Commit

Permalink
fix get lang from cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
NarenderRajuB committed Oct 15, 2024
1 parent 3201b86 commit c1265fe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fsd_utils/locale_selector/get_lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def get_lang():
# get locale from cookie if set
locale_from_cookie = request.cookies.get(CommonConfig.FSD_LANG_COOKIE_NAME)
if locale_from_cookie:
if locale_from_cookie not in ["cy", "en"]:
current_app.logger.warning(
f"Invalid language code {locale_from_cookie}. Supported codes are 'cy' and 'en'."
)
return "en"
return locale_from_cookie

# otherwise guess preference based on user accept header
Expand Down

0 comments on commit c1265fe

Please sign in to comment.