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:
79
app/modules/core/locales/en.json
Normal file
79
app/modules/core/locales/en.json
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"title": "Dashboard",
|
||||
"welcome": "Welcome back",
|
||||
"overview": "Overview",
|
||||
"quick_stats": "Quick Stats",
|
||||
"recent_activity": "Recent Activity",
|
||||
"total_products": "Total Products",
|
||||
"total_orders": "Total Orders",
|
||||
"total_customers": "Total Customers",
|
||||
"total_revenue": "Total Revenue",
|
||||
"active_products": "Active Products",
|
||||
"pending_orders": "Pending Orders",
|
||||
"new_customers": "New Customers",
|
||||
"today": "Today",
|
||||
"this_week": "This Week",
|
||||
"this_month": "This Month",
|
||||
"this_year": "This Year",
|
||||
"error_loading": "Error loading dashboard",
|
||||
"no_data": "No data available"
|
||||
},
|
||||
"settings": {
|
||||
"title": "Settings",
|
||||
"general": "General",
|
||||
"store": "Store",
|
||||
"store_name": "Store Name",
|
||||
"store_description": "Store Description",
|
||||
"contact_email": "Contact Email",
|
||||
"contact_phone": "Contact Phone",
|
||||
"business_address": "Business Address",
|
||||
"tax_number": "Tax Number",
|
||||
"currency": "Currency",
|
||||
"timezone": "Timezone",
|
||||
"language": "Language",
|
||||
"language_settings": "Language Settings",
|
||||
"default_language": "Default Language",
|
||||
"dashboard_language": "Dashboard Language",
|
||||
"storefront_language": "Storefront Language",
|
||||
"enabled_languages": "Enabled Languages",
|
||||
"notifications": "Notifications",
|
||||
"email_notifications": "Email Notifications",
|
||||
"integrations": "Integrations",
|
||||
"api_keys": "API Keys",
|
||||
"webhooks": "Webhooks",
|
||||
"save_settings": "Save Settings",
|
||||
"settings_saved": "Settings saved successfully"
|
||||
},
|
||||
"profile": {
|
||||
"title": "Profile",
|
||||
"my_profile": "My Profile",
|
||||
"edit_profile": "Edit Profile",
|
||||
"personal_info": "Personal Information",
|
||||
"first_name": "First Name",
|
||||
"last_name": "Last Name",
|
||||
"email": "Email",
|
||||
"phone": "Phone",
|
||||
"avatar": "Avatar",
|
||||
"change_avatar": "Change Avatar",
|
||||
"security": "Security",
|
||||
"two_factor": "Two-Factor Authentication",
|
||||
"sessions": "Active Sessions",
|
||||
"preferences": "Preferences",
|
||||
"language_preference": "Language Preference",
|
||||
"save_profile": "Save Profile",
|
||||
"profile_updated": "Profile updated successfully"
|
||||
},
|
||||
"messages": {
|
||||
"failed_to_load_dashboard_data": "Failed to load dashboard data",
|
||||
"dashboard_refreshed": "Dashboard refreshed",
|
||||
"item_removed_from_cart": "Item removed from cart",
|
||||
"cart_cleared": "Cart cleared"
|
||||
},
|
||||
"confirmations": {
|
||||
"show_all_menu_items": "This will show all menu items. Continue?",
|
||||
"hide_all_menu_items": "This will hide all menu items (except mandatory ones). You can then enable the ones you want. Continue?",
|
||||
"reset_email_settings": "This will reset all email settings to use .env defaults. Continue?",
|
||||
"cleanup_logs": "This will delete all logs older than {days} days. Continue?"
|
||||
}
|
||||
}
|
||||
@@ -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