Updated PLANS.md, AGENTS.md, and arabic-localization.md to reflect the “foundations now, full translations later” approach and marked progress accordingly.

Implemented localization foundations across backend and frontend (locale settings/middleware, preferred language, i18n wiring, RTL support, minimal Arabic UI strings, Accept-Language).
Added targeted backend and frontend tests plus a risks note for pending full translation coverage.
This commit is contained in:
2026-02-28 11:48:58 +03:00
parent fd90af33b3
commit d40bb10876
27 changed files with 407 additions and 68 deletions
+28
View File
@@ -0,0 +1,28 @@
from django.utils import translation
class UserLocaleMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
language = None
activated = False
user = getattr(request, "user", None)
if user and getattr(user, "is_authenticated", False):
language = getattr(user, "preferred_language", None)
if language:
translation.activate(language)
request.LANGUAGE_CODE = language
activated = True
response = self.get_response(request)
active_language = translation.get_language()
if active_language:
response["Content-Language"] = active_language
if activated:
translation.deactivate()
return response