From 4087e685f4fb5568410831dd312eec286a0e7067 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sat, 1 Feb 2020 13:40:29 +0100 Subject: [PATCH] Fix auto detection of locale --- cps/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cps/__init__.py b/cps/__init__.py index abcc4cbb..6c241d4f 100755 --- a/cps/__init__.py +++ b/cps/__init__.py @@ -116,14 +116,13 @@ def get_locale(): if user.nickname != 'Guest': # if the account is the guest account bypass the config lang settings return user.locale - preferred = set() + preferred = list() if request.accept_languages: for x in request.accept_languages.values(): try: - preferred.add(str(LC.parse(x.replace('-', '_')))) + preferred.append(str(LC.parse(x.replace('-', '_')))) except (UnknownLocaleError, ValueError) as e: - log.warning('Could not parse locale "%s": %s', x, e) - # preferred.append('en') + log.debug('Could not parse locale "%s": %s', x, e) return negotiate_locale(preferred or ['en'], _BABEL_TRANSLATIONS)