fix(i18n): convert remaining $t() to server-side _() and fix store dashboard language
Some checks failed
CI / pytest (push) Waiting to run
CI / ruff (push) Successful in 13s
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / validate (push) Has been cancelled

- Convert storefront enrollment $t() calls to server-side _() to silence
  dev-toolbar warnings (welcome bonus + join button)
- Fix store base template I18n.init() to use current_language (from middleware)
  instead of dashboard_language (hardcoded store config) so language changes
  take effect immediately
- Switch admin loyalty routes to use get_admin_context() for proper i18n support
- Switch store loyalty routes to use core get_store_context() from page_context
- Pass program object to storefront enrollment context for server-side rendering
- Add LANG-011 architecture rule: enforce $t()/_() over I18n.t() in templates
- Fix duplicate file_pattern key in LANG-004 rule (YAML validation error)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-14 17:00:42 +01:00
parent 502473eee4
commit a28d5d1de5
7 changed files with 56 additions and 80 deletions

View File

@@ -17,6 +17,7 @@ from sqlalchemy.orm import Session
from app.api.deps import get_current_customer_from_cookie_or_header, get_db
from app.modules.core.utils.page_context import get_storefront_context
from app.modules.customers.models import Customer
from app.modules.loyalty.services import program_service
from app.templates_config import templates
logger = logging.getLogger(__name__)
@@ -114,7 +115,10 @@ async def loyalty_self_enrollment(
},
)
context = get_storefront_context(request, db=db)
store = request.state.store
program = program_service.get_active_program_by_store(db, store.id) if store else None
context = get_storefront_context(request, db=db, program=program)
return templates.TemplateResponse(
"loyalty/storefront/enroll.html",
context,