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:
@@ -57,6 +57,9 @@ function adminMyMenuConfig() {
|
||||
},
|
||||
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('core');
|
||||
|
||||
// Guard against multiple initialization
|
||||
if (window._adminMyMenuConfigInitialized) {
|
||||
myMenuConfigLog.warn('Already initialized, skipping');
|
||||
@@ -141,7 +144,7 @@ function adminMyMenuConfig() {
|
||||
},
|
||||
|
||||
async showAll() {
|
||||
if (!confirm('This will show all menu items. Continue?')) {
|
||||
if (!confirm(I18n.t('core.confirmations.show_all_menu_items'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -163,7 +166,7 @@ function adminMyMenuConfig() {
|
||||
},
|
||||
|
||||
async resetToDefaults() {
|
||||
if (!confirm('This will hide all menu items (except mandatory ones). You can then enable the ones you want. Continue?')) {
|
||||
if (!confirm(I18n.t('core.confirmations.hide_all_menu_items'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,9 @@ function adminSettings() {
|
||||
testEmailSuccess: null,
|
||||
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('core');
|
||||
|
||||
// Guard against multiple initialization
|
||||
if (window._adminSettingsInitialized) return;
|
||||
window._adminSettingsInitialized = true;
|
||||
@@ -434,7 +437,7 @@ function adminSettings() {
|
||||
},
|
||||
|
||||
async resetEmailSettings() {
|
||||
if (!confirm('This will reset all email settings to use .env defaults. Continue?')) {
|
||||
if (!confirm(I18n.t('core.confirmations.reset_email_settings'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,13 +153,13 @@ function shopLayoutData() {
|
||||
removeFromCart(productId) {
|
||||
this.cart = this.cart.filter(item => item.id !== productId);
|
||||
this.saveCart();
|
||||
this.showToast('Item removed from cart', 'info');
|
||||
this.showToast(I18n.t('core.messages.item_removed_from_cart'), 'info');
|
||||
},
|
||||
|
||||
clearCart() {
|
||||
this.cart = [];
|
||||
this.saveCart();
|
||||
this.showToast('Cart cleared', 'info');
|
||||
this.showToast(I18n.t('core.messages.cart_cleared'), 'info');
|
||||
},
|
||||
|
||||
saveCart() {
|
||||
|
||||
Reference in New Issue
Block a user