refactor: complete JS i18n migration for confirm dialogs and toast messages
Migrate 34 hardcoded user-facing strings to use I18n.t() for translation: - CMS: media file operations (5 strings) - Marketplace: Letzshop integration (16 strings) - Messaging: notifications, messages, email templates (5 strings) - Tenancy: platform modules, menu config, theme (5 strings) - Core: menu config, settings, storefront cart (5 strings) - Catalog: product creation (3 strings) - Utils: clipboard operations (2 strings) Added confirmations and messages keys to module locale files. Added I18n.loadModule() calls to JS files that were missing them. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,9 @@ function vendorEmailTemplates() {
|
||||
|
||||
// Lifecycle
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('messaging');
|
||||
|
||||
if (window._vendorEmailTemplatesInitialized) return;
|
||||
window._vendorEmailTemplatesInitialized = true;
|
||||
|
||||
@@ -134,7 +137,7 @@ function vendorEmailTemplates() {
|
||||
Utils.showToast(`No template available for ${this.editLanguage.toUpperCase()}`, 'info');
|
||||
} else {
|
||||
vendorEmailTemplatesLog.error('Failed to load template:', error);
|
||||
Utils.showToast('Failed to load template', 'error');
|
||||
Utils.showToast(I18n.t('messaging.messages.failed_to_load_template'), 'error');
|
||||
}
|
||||
} finally {
|
||||
this.loadingTemplate = false;
|
||||
@@ -166,7 +169,7 @@ function vendorEmailTemplates() {
|
||||
}
|
||||
);
|
||||
|
||||
Utils.showToast('Template saved successfully', 'success');
|
||||
Utils.showToast(I18n.t('messaging.messages.template_saved_successfully'), 'success');
|
||||
this.templateSource = 'vendor_override';
|
||||
// Refresh list to show updated status
|
||||
await this.loadData();
|
||||
@@ -181,7 +184,7 @@ function vendorEmailTemplates() {
|
||||
async revertToDefault() {
|
||||
if (!this.editingTemplate) return;
|
||||
|
||||
if (!confirm('Are you sure you want to delete your customization and revert to the platform default?')) {
|
||||
if (!confirm(I18n.t('messaging.confirmations.delete_customization'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,7 +195,7 @@ function vendorEmailTemplates() {
|
||||
`/vendor/email-templates/${this.editingTemplate.code}/${this.editLanguage}`
|
||||
);
|
||||
|
||||
Utils.showToast('Reverted to platform default', 'success');
|
||||
Utils.showToast(I18n.t('messaging.messages.reverted_to_platform_default'), 'success');
|
||||
// Reload the template to show platform version
|
||||
await this.loadTemplateLanguage();
|
||||
// Refresh list
|
||||
@@ -222,7 +225,7 @@ function vendorEmailTemplates() {
|
||||
this.showPreviewModal = true;
|
||||
} catch (error) {
|
||||
vendorEmailTemplatesLog.error('Failed to preview template:', error);
|
||||
Utils.showToast('Failed to load preview', 'error');
|
||||
Utils.showToast(I18n.t('messaging.messages.failed_to_load_preview'), 'error');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -255,7 +258,7 @@ function vendorEmailTemplates() {
|
||||
}
|
||||
} catch (error) {
|
||||
vendorEmailTemplatesLog.error('Failed to send test email:', error);
|
||||
Utils.showToast('Failed to send test email', 'error');
|
||||
Utils.showToast(I18n.t('messaging.messages.failed_to_send_test_email'), 'error');
|
||||
} finally {
|
||||
this.sendingTest = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user