i18n: use consistent way of setting user language.
This commit is contained in:
parent
4be3097bae
commit
526cdfd9b2
3 changed files with 17 additions and 15 deletions
|
|
@ -63,6 +63,15 @@ def add_localizer(event):
|
|||
request.plularize = localizer.pluralize
|
||||
|
||||
|
||||
def set_user_lang(event):
|
||||
cur_user = getattr(event.request, 'user', None)
|
||||
|
||||
if cur_user:
|
||||
user_lang = cur_user.get_instance().user_data.get('language')
|
||||
if user_lang:
|
||||
event.request._LOCALE_ = user_lang
|
||||
|
||||
|
||||
def scan_repositories_if_enabled(event):
|
||||
"""
|
||||
This is subscribed to the `pyramid.events.ApplicationCreated` event. It
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue