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:
2026-02-01 17:29:13 +01:00
parent 1d78085085
commit 09d7d282c6
24 changed files with 681 additions and 822 deletions

View File

@@ -52,6 +52,9 @@ function adminPlatformMenuConfig(platformCode) {
},
async init() {
// Load i18n translations
await I18n.loadModule('tenancy');
// Guard against duplicate initialization
if (window._platformMenuConfigInitialized) {
menuConfigLog.warn('Already initialized, skipping');
@@ -158,7 +161,7 @@ function adminPlatformMenuConfig(platformCode) {
},
async showAll() {
if (!confirm('This will show all menu items. Continue?')) {
if (!confirm(I18n.t('tenancy.confirmations.show_all_menu_items'))) {
return;
}
@@ -184,7 +187,7 @@ function adminPlatformMenuConfig(platformCode) {
},
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('tenancy.confirmations.hide_all_menu_items'))) {
return;
}

View File

@@ -65,6 +65,9 @@ function adminPlatformModules(platformCode) {
},
async init() {
// Load i18n translations
await I18n.loadModule('tenancy');
// Guard against duplicate initialization
if (window._platformModulesInitialized) {
moduleConfigLog.warn('Already initialized, skipping');
@@ -173,7 +176,7 @@ function adminPlatformModules(platformCode) {
},
async enableAll() {
if (!confirm('This will enable all modules. Continue?')) {
if (!confirm(I18n.t('tenancy.confirmations.enable_all_modules'))) {
return;
}
@@ -204,7 +207,7 @@ function adminPlatformModules(platformCode) {
},
async disableOptional() {
if (!confirm('This will disable all optional modules, keeping only core modules. Continue?')) {
if (!confirm(I18n.t('tenancy.confirmations.disable_optional_modules'))) {
return;
}

View File

@@ -78,6 +78,9 @@ function adminVendorTheme() {
// ====================================================================
async init() {
// Load i18n translations
await I18n.loadModule('tenancy');
// Guard against multiple initialization
if (window._adminVendorThemeInitialized) return;
window._adminVendorThemeInitialized = true;
@@ -225,7 +228,7 @@ function adminVendorTheme() {
window.LogConfig.logPerformance('Save Theme', duration);
themeLog.info('Theme saved successfully');
Utils.showToast('Theme saved successfully', 'success');
Utils.showToast(I18n.t('tenancy.messages.theme_saved_successfully'), 'success');
} catch (error) {
window.LogConfig.logError(error, 'Save Theme');
@@ -262,14 +265,14 @@ function adminVendorTheme() {
} catch (error) {
window.LogConfig.logError(error, 'Apply Preset');
Utils.showToast('Failed to apply preset', 'error');
Utils.showToast(I18n.t('tenancy.messages.failed_to_apply_preset'), 'error');
} finally {
this.saving = false;
}
},
async resetTheme() {
if (!confirm('Reset theme to default? This cannot be undone.')) {
if (!confirm(I18n.t('tenancy.confirmations.reset_theme'))) {
return;
}
@@ -288,11 +291,11 @@ function adminVendorTheme() {
await this.loadTheme();
themeLog.info('Theme reset successfully');
Utils.showToast('Theme reset to default', 'success');
Utils.showToast(I18n.t('tenancy.messages.theme_reset_to_default'), 'success');
} catch (error) {
window.LogConfig.logError(error, 'Reset Theme');
Utils.showToast('Failed to reset theme', 'error');
Utils.showToast(I18n.t('tenancy.messages.failed_to_reset_theme'), 'error');
} finally {
this.saving = false;
}