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

Fix language selection on python3

This commit is contained in:
Ozzieisaacs 2019-09-06 20:56:17 +02:00
parent 1fb45d769f
commit 6cda5fee0d
2 changed files with 2 additions and 8 deletions

View File

@ -108,7 +108,7 @@ def create_app():
return app return app
@babel.localeselector @babel.localeselector
def negociate_locale(): 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)
# user = None # user = None
@ -128,10 +128,6 @@ def negociate_locale():
return negotiate_locale(preferred or ['en'], _BABEL_TRANSLATIONS) return negotiate_locale(preferred or ['en'], _BABEL_TRANSLATIONS)
def get_locale():
return request._locale
@babel.timezoneselector @babel.timezoneselector
def get_timezone(): def get_timezone():
user = getattr(g, 'user', None) user = getattr(g, 'user', None)

View File

@ -44,7 +44,7 @@ from werkzeug.datastructures import Headers
from werkzeug.security import generate_password_hash, check_password_hash from werkzeug.security import generate_password_hash, check_password_hash
from . import constants, logger, isoLanguages, services, worker from . import constants, logger, isoLanguages, services, worker
from . import searched_ids, lm, babel, db, ub, config, negociate_locale, get_locale, app from . import searched_ids, lm, babel, db, ub, config, get_locale, app
from .gdriveutils import getFileFromEbooksFolder, do_gdrive_download from .gdriveutils import getFileFromEbooksFolder, do_gdrive_download
from .helper import common_filters, get_search_results, fill_indexpage, speaking_language, check_valid_domain, \ from .helper import common_filters, get_search_results, fill_indexpage, speaking_language, check_valid_domain, \
order_authors, get_typeahead, render_task_status, json_serial, get_cc_columns, \ order_authors, get_typeahead, render_task_status, json_serial, get_cc_columns, \
@ -242,8 +242,6 @@ def render_title_template(*args, **kwargs):
@web.before_app_request @web.before_app_request
def before_request(): def before_request():
# log.debug("before_request: %s %s %r", request.method, request.path, getattr(request, 'locale', None))
request._locale = negociate_locale()
g.user = current_user g.user = current_user
g.allow_registration = config.config_public_reg g.allow_registration = config.config_public_reg
g.allow_anonymous = config.config_anonbrowse g.allow_anonymous = config.config_anonbrowse