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

@@ -3758,6 +3758,19 @@ class ArchitectureValidator:
context=line.strip()[:80],
suggestion="Use single quotes: x-data='func({{ data|tojson }})'",
)
# LANG-011: I18n.t() in templates (should use $t() or server-side _())
if "I18n.t(" in line:
self._add_violation(
rule_id="LANG-011",
rule_name="Use $t() not I18n.t() in HTML templates",
severity=Severity.ERROR,
file_path=file_path,
line_number=i,
message="I18n.t() is non-reactive in templates. Use $t() (reactive) or _() (server-side)",
context=line.strip()[:80],
suggestion="Replace I18n.t('key') with $t('key') or {{ _('key') }}",
)
except Exception:
pass # Skip files that can't be read