from django.utils.translation import get_language
import logging

logger = logging.getLogger(__name__)

class LanguageDebugMiddleware:
    def __init__(self, get_response):
        self.get_response = get_response

    def __call__(self, request):
        response = self.get_response(request)
        # Log the current language for debugging
        print(f"DEBUG: Path: {request.path}, Lang: {get_language()}, Cookie: {request.COOKIES.get('django_language')}")
        return response
