fix(loyalty): sweep remaining hardcoded 'en-US' in persona JS files

Follow-up to 06e59f73 which swept non-loyalty modules. The earlier
loyalty fix (dd1f9af8) only touched the shared/ factories; persona-
specific JS files in loyalty's admin/, merchant/, store/, and
storefront/ dirs were missed and still hardcoded 'en-US'.

13 occurrences across 8 files now use I18n.locale:
- admin: loyalty-analytics.js, loyalty-merchant-detail.js,
  loyalty-programs.js
- merchant: loyalty-analytics.js
- store: loyalty-analytics.js, loyalty-terminal.js
- storefront: loyalty-dashboard.js, loyalty-history.js

After this commit grep -rn "'en-US'" --include=*.js across the whole
repo returns nothing. Clearing the deck so the JS-016 rule can ship
at error severity in the next commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 23:51:24 +02:00
parent 06e59f73b3
commit bb4c400436
8 changed files with 13 additions and 13 deletions

View File

@@ -188,7 +188,7 @@ function adminLoyaltyAnalytics() {
formatNumber(num) { formatNumber(num) {
if (num === null || num === undefined) return '0'; if (num === null || num === undefined) return '0';
return new Intl.NumberFormat('en-US').format(num); return new Intl.NumberFormat(I18n.locale).format(num);
} }
}; };
} }

View File

@@ -255,7 +255,7 @@ function adminLoyaltyMerchantDetail() {
if (!dateString) return 'N/A'; if (!dateString) return 'N/A';
try { try {
const date = new Date(dateString); const date = new Date(dateString);
return date.toLocaleDateString('en-US', { return date.toLocaleDateString(I18n.locale, {
year: 'numeric', year: 'numeric',
month: 'short', month: 'short',
day: 'numeric' day: 'numeric'
@@ -269,7 +269,7 @@ function adminLoyaltyMerchantDetail() {
// Format number with thousands separator // Format number with thousands separator
formatNumber(num) { formatNumber(num) {
if (num === null || num === undefined) return '0'; if (num === null || num === undefined) return '0';
return new Intl.NumberFormat('en-US').format(num); return new Intl.NumberFormat(I18n.locale).format(num);
}, },
// Transaction categories // Transaction categories

View File

@@ -325,7 +325,7 @@ function adminLoyaltyPrograms() {
if (!dateString) return 'N/A'; if (!dateString) return 'N/A';
try { try {
const date = new Date(dateString); const date = new Date(dateString);
return date.toLocaleDateString('en-US', { return date.toLocaleDateString(I18n.locale, {
year: 'numeric', year: 'numeric',
month: 'short', month: 'short',
day: 'numeric' day: 'numeric'
@@ -339,7 +339,7 @@ function adminLoyaltyPrograms() {
// Format number with thousands separator // Format number with thousands separator
formatNumber(num) { formatNumber(num) {
if (num === null || num === undefined) return '0'; if (num === null || num === undefined) return '0';
return new Intl.NumberFormat('en-US').format(num); return new Intl.NumberFormat(I18n.locale).format(num);
} }
}; };
} }

View File

@@ -98,7 +98,7 @@ function merchantLoyaltyAnalytics() {
formatNumber(num) { formatNumber(num) {
if (num === null || num === undefined) return '0'; if (num === null || num === undefined) return '0';
return new Intl.NumberFormat('en-US').format(num); return new Intl.NumberFormat(I18n.locale).format(num);
} }
}; };
} }

View File

@@ -174,7 +174,7 @@ function storeLoyaltyAnalytics() {
formatNumber(num) { formatNumber(num) {
if (num === null || num === undefined) return '0'; if (num === null || num === undefined) return '0';
return new Intl.NumberFormat('en-US').format(num); return new Intl.NumberFormat(I18n.locale).format(num);
} }
}; };
} }

View File

@@ -399,7 +399,7 @@ function storeLoyaltyTerminal() {
formatNumber(num) { formatNumber(num) {
if (num === null || num === undefined) return '0'; if (num === null || num === undefined) return '0';
return new Intl.NumberFormat('en-US').format(num); return new Intl.NumberFormat(I18n.locale).format(num);
}, },
// Format time // Format time
@@ -407,7 +407,7 @@ function storeLoyaltyTerminal() {
if (!dateString) return '-'; if (!dateString) return '-';
try { try {
const date = new Date(dateString); const date = new Date(dateString);
return date.toLocaleTimeString('en-US', { return date.toLocaleTimeString(I18n.locale, {
hour: '2-digit', hour: '2-digit',
minute: '2-digit' minute: '2-digit'
}); });

View File

@@ -73,13 +73,13 @@ function customerLoyaltyDashboard() {
formatNumber(num) { formatNumber(num) {
if (num == null) return '0'; if (num == null) return '0';
return new Intl.NumberFormat('en-US').format(num); return new Intl.NumberFormat(I18n.locale).format(num);
}, },
formatDate(dateString) { formatDate(dateString) {
if (!dateString) return '-'; if (!dateString) return '-';
try { try {
return new Date(dateString).toLocaleDateString('en-US', { return new Date(dateString).toLocaleDateString(I18n.locale, {
year: 'numeric', year: 'numeric',
month: 'short', month: 'short',
day: 'numeric' day: 'numeric'

View File

@@ -93,13 +93,13 @@ function customerLoyaltyHistory() {
formatNumber(num) { formatNumber(num) {
if (num == null) return '0'; if (num == null) return '0';
return new Intl.NumberFormat('en-US').format(num); return new Intl.NumberFormat(I18n.locale).format(num);
}, },
formatDateTime(dateString) { formatDateTime(dateString) {
if (!dateString) return '-'; if (!dateString) return '-';
try { try {
return new Date(dateString).toLocaleString('en-US', { return new Date(dateString).toLocaleString(I18n.locale, {
year: 'numeric', year: 'numeric',
month: 'short', month: 'short',
day: 'numeric', day: 'numeric',