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:
@@ -44,6 +44,9 @@ function vendorProductCreate() {
|
||||
},
|
||||
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('catalog');
|
||||
|
||||
// Guard against duplicate initialization
|
||||
if (window._vendorProductCreateInitialized) return;
|
||||
window._vendorProductCreateInitialized = true;
|
||||
@@ -66,7 +69,7 @@ function vendorProductCreate() {
|
||||
|
||||
async createProduct() {
|
||||
if (!this.form.title || !this.form.price) {
|
||||
this.showToast('Title and price are required', 'error');
|
||||
Utils.showToast(I18n.t('catalog.messages.title_and_price_required'), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -93,7 +96,7 @@ function vendorProductCreate() {
|
||||
}
|
||||
|
||||
vendorProductCreateLog.info('Product created:', response.data);
|
||||
this.showToast('Product created successfully', 'success');
|
||||
Utils.showToast(I18n.t('catalog.messages.product_created_successfully'), 'success');
|
||||
|
||||
// Navigate back to products list
|
||||
setTimeout(() => {
|
||||
@@ -102,8 +105,8 @@ function vendorProductCreate() {
|
||||
|
||||
} catch (err) {
|
||||
vendorProductCreateLog.error('Failed to create product:', err);
|
||||
this.error = err.message || 'Failed to create product';
|
||||
this.showToast(this.error, 'error');
|
||||
this.error = err.message || I18n.t('catalog.messages.failed_to_create_product');
|
||||
Utils.showToast(this.error, 'error');
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user