fix(storefront-i18n): dashboard widgets translate + correct customer-module key paths
Some checks failed
CI / ruff (push) Successful in 17s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

Two bugs from Test 5.1 on FR storefront dashboard:

1. Loyalty + Orders dashboard cards (`StorefrontDashboardCard.title`/
   `subtitle`/`value_label`) were hardcoded English. Added `language`
   to `WidgetContext`; customer dashboard route passes
   `request.state.language` through; loyalty and orders widget
   providers now call `translate(..., context.language)` with new
   `widget.*` i18n keys × 4 locales each.

2. Customer-module locale JSON has redundant top-level `customers`
   wrapper, so after the module-locale loader auto-namespaces under
   module code `customers`, the actual key path is
   `customers.customers.customer_number` (matches the existing
   `loyalty.loyalty.wallet.apple` pattern). My earlier sweep used the
   single-prefix path for 8 references — fixed all to double-prefix.

Both bugs were visible end-of-day yesterday after the api container
recreate landed `1bade6e6`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 20:45:46 +02:00
parent acbe2eff1a
commit 5f359283bc
15 changed files with 93 additions and 15 deletions

View File

@@ -156,12 +156,12 @@
<!-- Name Row -->
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">{{ _('customers.first_name') }} *</label>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">{{ _('customers.customers.first_name') }} *</label>
<input type="text" x-model="addressForm.first_name" required
class="block w-full rounded-md border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white shadow-sm focus:border-primary focus:ring-primary sm:text-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">{{ _('customers.last_name') }} *</label>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">{{ _('customers.customers.last_name') }} *</label>
<input type="text" x-model="addressForm.last_name" required
class="block w-full rounded-md border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white shadow-sm focus:border-primary focus:ring-primary sm:text-sm">
</div>

View File

@@ -105,7 +105,7 @@
<p class="text-lg font-semibold text-gray-900 dark:text-white">{{ user.created_at.strftime('%B %Y') }}</p>
</div>
<div>
<p class="text-sm text-gray-600 dark:text-gray-400 mb-1">{{ _('customers.customer_number') }}</p>
<p class="text-sm text-gray-600 dark:text-gray-400 mb-1">{{ _('customers.customers.customer_number') }}</p>
<p class="text-lg font-semibold text-gray-900 dark:text-white">{{ user.customer_number }}</p>
</div>
</div>

View File

@@ -66,7 +66,7 @@
<!-- First Name -->
<div>
<label for="first_name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
{{ _('customers.first_name') }} <span class="text-red-500">*</span>
{{ _('customers.customers.first_name') }} <span class="text-red-500">*</span>
</label>
<input type="text" id="first_name" x-model="profileForm.first_name" required
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm
@@ -78,7 +78,7 @@
<!-- Last Name -->
<div>
<label for="last_name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
{{ _('customers.last_name') }} <span class="text-red-500">*</span>
{{ _('customers.customers.last_name') }} <span class="text-red-500">*</span>
</label>
<input type="text" id="last_name" x-model="profileForm.last_name" required
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm
@@ -263,7 +263,7 @@
<h3 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-4">{{ _('customers.storefront.pages.profile.account_info') }}</h3>
<dl class="grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm">
<div>
<dt class="text-gray-500 dark:text-gray-400">{{ _('customers.customer_number') }}</dt>
<dt class="text-gray-500 dark:text-gray-400">{{ _('customers.customers.customer_number') }}</dt>
<dd class="mt-1 text-gray-900 dark:text-white font-medium" x-text="profile?.customer_number || '-'"></dd>
</div>
<div>
@@ -271,11 +271,11 @@
<dd class="mt-1 text-gray-900 dark:text-white font-medium" x-text="formatDate(profile?.created_at)"></dd>
</div>
<div>
<dt class="text-gray-500 dark:text-gray-400">{{ _('customers.total_orders') }}</dt>
<dt class="text-gray-500 dark:text-gray-400">{{ _('customers.customers.total_orders') }}</dt>
<dd class="mt-1 text-gray-900 dark:text-white font-medium" x-text="profile?.total_orders || 0"></dd>
</div>
<div>
<dt class="text-gray-500 dark:text-gray-400">{{ _('customers.total_spent') }}</dt>
<dt class="text-gray-500 dark:text-gray-400">{{ _('customers.customers.total_spent') }}</dt>
<dd class="mt-1 text-gray-900 dark:text-white font-medium" x-text="formatPrice(profile?.total_spent)"></dd>
</div>
</dl>