feat(loyalty): add full i18n support for all loyalty module pages
Replace hardcoded English strings across all 22 templates, 10 JS files, and 4 locale files (en/fr/de/lb) with ~300 translation keys per language. Uses server-side _() for Jinja2 templates and I18n.t() for JS toast messages and dynamic Alpine.js expressions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -190,12 +190,12 @@ function adminLoyaltyMerchantDetail() {
|
||||
};
|
||||
const response = await apiClient.post(`/admin/loyalty/merchants/${this.merchantId}/program`, data);
|
||||
this.program = response;
|
||||
Utils.showToast('Loyalty program created', 'success');
|
||||
Utils.showToast(I18n.t('loyalty.toasts.program_created'), 'success');
|
||||
loyaltyMerchantDetailLog.info('Program created for merchant', this.merchantId);
|
||||
// Reload stats
|
||||
await this.loadStats();
|
||||
} catch (error) {
|
||||
Utils.showToast(`Failed to create program: ${error.message}`, 'error');
|
||||
Utils.showToast(I18n.t('loyalty.toasts.create_failed', {message: error.message}), 'error');
|
||||
loyaltyMerchantDetailLog.error('Failed to create program:', error);
|
||||
}
|
||||
},
|
||||
@@ -207,10 +207,10 @@ function adminLoyaltyMerchantDetail() {
|
||||
try {
|
||||
const response = await apiClient.post(`/admin/loyalty/programs/${this.program.id}/${action}`);
|
||||
this.program.is_active = response.is_active;
|
||||
Utils.showToast(`Program ${action}d successfully`, 'success');
|
||||
Utils.showToast(I18n.t(`loyalty.toasts.program_${action}d`), 'success');
|
||||
loyaltyMerchantDetailLog.info(`Program ${action}d`);
|
||||
} catch (error) {
|
||||
Utils.showToast(`Failed to ${action} program: ${error.message}`, 'error');
|
||||
Utils.showToast(I18n.t(`loyalty.toasts.${action}_failed`, {message: error.message}), 'error');
|
||||
loyaltyMerchantDetailLog.error(`Failed to ${action} program:`, error);
|
||||
}
|
||||
},
|
||||
@@ -227,12 +227,12 @@ function adminLoyaltyMerchantDetail() {
|
||||
await apiClient.delete(`/admin/loyalty/programs/${this.program.id}`);
|
||||
this.program = null;
|
||||
this.showDeleteModal = false;
|
||||
Utils.showToast('Loyalty program deleted', 'success');
|
||||
Utils.showToast(I18n.t('loyalty.toasts.program_deleted'), 'success');
|
||||
loyaltyMerchantDetailLog.info('Program deleted');
|
||||
// Reload stats
|
||||
await this.loadStats();
|
||||
} catch (error) {
|
||||
Utils.showToast(`Failed to delete program: ${error.message}`, 'error');
|
||||
Utils.showToast(I18n.t('loyalty.toasts.delete_failed', {message: error.message}), 'error');
|
||||
loyaltyMerchantDetailLog.error('Failed to delete program:', error);
|
||||
this.showDeleteModal = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user