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

@@ -67,6 +67,9 @@ function adminMessages(initialConversationId = null) {
* Initialize component
*/
async init() {
// Load i18n translations
await I18n.loadModule('messaging');
// Guard against multiple initialization
if (window._adminMessagesInitialized) return;
window._adminMessagesInitialized = true;
@@ -141,7 +144,7 @@ function adminMessages(initialConversationId = null) {
messagesLog.debug(`Loaded ${this.conversations.length} conversations`);
} catch (error) {
messagesLog.error('Failed to load conversations:', error);
Utils.showToast('Failed to load conversations', 'error');
Utils.showToast(I18n.t('messaging.messages.failed_to_load_conversations'), 'error');
} finally {
this.loadingConversations = false;
}
@@ -197,7 +200,7 @@ function adminMessages(initialConversationId = null) {
this.scrollToBottom();
} catch (error) {
messagesLog.error('Failed to load conversation:', error);
Utils.showToast('Failed to load conversation', 'error');
Utils.showToast(I18n.t('messaging.messages.failed_to_load_conversation'), 'error');
} finally {
this.loadingMessages = false;
}
@@ -301,7 +304,7 @@ function adminMessages(initialConversationId = null) {
* Close conversation
*/
async closeConversation() {
if (!confirm('Are you sure you want to close this conversation?')) return;
if (!confirm(I18n.t('messaging.confirmations.close_conversation_admin'))) return;
try {
await apiClient.post(`/admin/messages/${this.selectedConversationId}/close`);
@@ -316,10 +319,10 @@ function adminMessages(initialConversationId = null) {
conv.is_closed = true;
}
Utils.showToast('Conversation closed', 'success');
Utils.showToast(I18n.t('messaging.messages.conversation_closed'), 'success');
} catch (error) {
messagesLog.error('Failed to close conversation:', error);
Utils.showToast('Failed to close conversation', 'error');
Utils.showToast(I18n.t('messaging.messages.failed_to_close_conversation'), 'error');
}
},
@@ -340,10 +343,10 @@ function adminMessages(initialConversationId = null) {
conv.is_closed = false;
}
Utils.showToast('Conversation reopened', 'success');
Utils.showToast(I18n.t('messaging.messages.conversation_reopened'), 'success');
} catch (error) {
messagesLog.error('Failed to reopen conversation:', error);
Utils.showToast('Failed to reopen conversation', 'error');
Utils.showToast(I18n.t('messaging.messages.failed_to_reopen_conversation'), 'error');
}
},
@@ -367,7 +370,7 @@ function adminMessages(initialConversationId = null) {
messagesLog.debug(`Loaded ${this.recipients.length} recipients`);
} catch (error) {
messagesLog.error('Failed to load recipients:', error);
Utils.showToast('Failed to load recipients', 'error');
Utils.showToast(I18n.t('messaging.messages.failed_to_load_recipients'), 'error');
} finally {
this.loadingRecipients = false;
}
@@ -416,7 +419,7 @@ function adminMessages(initialConversationId = null) {
await this.loadConversations();
await this.selectConversation(response.id);
Utils.showToast('Conversation created', 'success');
Utils.showToast(I18n.t('messaging.messages.conversation_created'), 'success');
} catch (error) {
messagesLog.error('Failed to create conversation:', error);
Utils.showToast(error.message || 'Failed to create conversation', 'error');