1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-26 10:00:37 +00:00

Fix for #621 - Login page always in english

This commit is contained in:
bodybybuddha 2018-09-17 13:03:29 -04:00
parent 0bb148e6e3
commit be0ddf25e4

View File

@ -214,6 +214,7 @@ def get_locale():
# if a user is logged in, use the locale from the user settings # if a user is logged in, use the locale from the user settings
user = getattr(g, 'user', None) user = getattr(g, 'user', None)
if user is not None and hasattr(user, "locale"): if user is not None and hasattr(user, "locale"):
if user.nickname != 'Guest': # if the account is the guest account bypass the config lang settings
return user.locale return user.locale
translations = [item.language for item in babel.list_translations()] + ['en'] translations = [item.language for item in babel.list_translations()] + ['en']
preferred = [x.replace('-', '_') for x in request.accept_languages.values()] preferred = [x.replace('-', '_') for x in request.accept_languages.values()]