Improve teams settings invites and due tasks

This commit is contained in:
rucki
2026-08-23 17:50:21 +02:00
parent c409fbc441
commit c7f7bc801e
25 changed files with 1165 additions and 454 deletions
+24
View File
@@ -0,0 +1,24 @@
from django.utils import translation
class UserLanguageMiddleware:
"""Prefer the authenticated user's saved language over browser/cookie language."""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
user = getattr(request, 'user', None)
language = ''
if user and user.is_authenticated:
try:
language = user.preferences.language
except Exception:
language = ''
if language:
translation.activate(language)
request.LANGUAGE_CODE = language
response = self.get_response(request)
if language:
response.setdefault('Content-Language', language)
return response