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:
@@ -249,10 +249,10 @@ function adminLoyaltyPrograms() {
|
||||
try {
|
||||
const response = await apiClient.post(`/admin/loyalty/programs/${program.id}/${action}`);
|
||||
program.is_active = response.is_active;
|
||||
Utils.showToast(`Program ${action}d successfully`, 'success');
|
||||
Utils.showToast(I18n.t(`loyalty.toasts.program_${action}d`), 'success');
|
||||
loyaltyProgramsLog.info(`Program ${program.id} ${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');
|
||||
loyaltyProgramsLog.error(`Failed to ${action} program:`, error);
|
||||
}
|
||||
},
|
||||
@@ -267,13 +267,13 @@ function adminLoyaltyPrograms() {
|
||||
if (!this.deletingProgram) return;
|
||||
try {
|
||||
await apiClient.delete(`/admin/loyalty/programs/${this.deletingProgram.id}`);
|
||||
Utils.showToast('Program deleted successfully', 'success');
|
||||
Utils.showToast(I18n.t('loyalty.toasts.program_deleted'), 'success');
|
||||
loyaltyProgramsLog.info('Program deleted:', this.deletingProgram.id);
|
||||
this.showDeleteModal = false;
|
||||
this.deletingProgram = null;
|
||||
await Promise.all([this.loadPrograms(), 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');
|
||||
loyaltyProgramsLog.error('Failed to delete program:', error);
|
||||
this.showDeleteModal = false;
|
||||
this.deletingProgram = null;
|
||||
|
||||
Reference in New Issue
Block a user