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:
@@ -1,9 +1,11 @@
|
||||
import re
|
||||
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
|
||||
def normalize_phone_number(raw_phone: str) -> str:
|
||||
if not raw_phone:
|
||||
raise ValueError("Phone number is required")
|
||||
raise ValueError(_("Phone number is required"))
|
||||
|
||||
phone = re.sub(r"[\s\-\(\)]", "", raw_phone)
|
||||
if phone.startswith("00"):
|
||||
@@ -12,7 +14,7 @@ def normalize_phone_number(raw_phone: str) -> str:
|
||||
if phone.startswith("+"):
|
||||
digits = phone[1:]
|
||||
if not digits.isdigit() or not (8 <= len(digits) <= 15):
|
||||
raise ValueError("Invalid phone number format")
|
||||
raise ValueError(_("Invalid phone number format"))
|
||||
return "+" + digits
|
||||
|
||||
digits = re.sub(r"\D", "", phone)
|
||||
@@ -23,4 +25,4 @@ def normalize_phone_number(raw_phone: str) -> str:
|
||||
if digits.startswith("5") and len(digits) == 9:
|
||||
return "+966" + digits
|
||||
|
||||
raise ValueError("Phone number must be in E.164 format or a valid Saudi mobile")
|
||||
raise ValueError(_("Phone number must be in E.164 format or a valid Saudi mobile"))
|
||||
|
||||
Reference in New Issue
Block a user