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:
@@ -64,6 +64,9 @@ function adminLetzshop() {
|
||||
vendorOrders: [],
|
||||
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('marketplace');
|
||||
|
||||
// Guard against multiple initialization
|
||||
if (window._adminLetzshopInitialized) {
|
||||
return;
|
||||
@@ -188,7 +191,7 @@ function adminLetzshop() {
|
||||
* Delete vendor configuration
|
||||
*/
|
||||
async deleteVendorConfig() {
|
||||
if (!confirm('Are you sure you want to remove Letzshop configuration for this vendor?')) {
|
||||
if (!confirm(I18n.t('marketplace.confirmations.remove_letzshop_config_vendor'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,6 +227,9 @@ function adminMarketplaceLetzshop() {
|
||||
},
|
||||
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('marketplace');
|
||||
|
||||
marketplaceLetzshopLog.info('init() called');
|
||||
|
||||
// Guard against multiple initialization
|
||||
@@ -1007,7 +1010,7 @@ function adminMarketplaceLetzshop() {
|
||||
async declineOrder(order) {
|
||||
if (!this.selectedVendor) return;
|
||||
|
||||
if (!confirm('Are you sure you want to decline this order? All items will be marked as unavailable.')) return;
|
||||
if (!confirm(I18n.t('marketplace.confirmations.decline_order'))) return;
|
||||
|
||||
try {
|
||||
await apiClient.post(`/admin/letzshop/vendors/${this.selectedVendor.id}/orders/${order.id}/reject`);
|
||||
@@ -1125,7 +1128,7 @@ function adminMarketplaceLetzshop() {
|
||||
async confirmAllItems(order) {
|
||||
if (!this.selectedVendor) return;
|
||||
|
||||
if (!confirm('Are you sure you want to confirm all items in this order?')) return;
|
||||
if (!confirm(I18n.t('marketplace.confirmations.confirm_all_items'))) return;
|
||||
|
||||
try {
|
||||
await apiClient.post(
|
||||
@@ -1146,7 +1149,7 @@ function adminMarketplaceLetzshop() {
|
||||
async declineAllItems(order) {
|
||||
if (!this.selectedVendor) return;
|
||||
|
||||
if (!confirm('Are you sure you want to decline all items in this order?')) return;
|
||||
if (!confirm(I18n.t('marketplace.confirmations.decline_all_items'))) return;
|
||||
|
||||
try {
|
||||
await apiClient.post(
|
||||
@@ -1238,7 +1241,7 @@ function adminMarketplaceLetzshop() {
|
||||
async deleteCredentials() {
|
||||
if (!this.selectedVendor) return;
|
||||
|
||||
if (!confirm('Are you sure you want to remove the Letzshop configuration? This will disable all Letzshop features for this vendor.')) {
|
||||
if (!confirm(I18n.t('marketplace.confirmations.remove_letzshop_config'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1456,7 +1459,7 @@ function adminMarketplaceLetzshop() {
|
||||
* Ignore an exception
|
||||
*/
|
||||
async ignoreException(exception) {
|
||||
if (!confirm('Are you sure you want to ignore this exception? The order will still be blocked from confirmation.')) {
|
||||
if (!confirm(I18n.t('marketplace.confirmations.ignore_exception'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1540,7 +1543,7 @@ function adminMarketplaceLetzshop() {
|
||||
if (job.type === 'import') {
|
||||
const errors = response.errors || [];
|
||||
if (errors.length === 0) {
|
||||
Utils.showToast('No error details available', 'info');
|
||||
Utils.showToast(I18n.t('marketplace.messages.no_error_details_available'), 'info');
|
||||
return;
|
||||
}
|
||||
// Store errors and show in job details modal
|
||||
@@ -1553,7 +1556,7 @@ function adminMarketplaceLetzshop() {
|
||||
}
|
||||
} catch (error) {
|
||||
marketplaceLetzshopLog.error('Failed to load job errors:', error);
|
||||
Utils.showToast('Failed to load error details', 'error');
|
||||
Utils.showToast(I18n.t('marketplace.messages.failed_to_load_error_details'), 'error');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user