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');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@ function vendorLetzshop() {
|
||||
exporting: false,
|
||||
|
||||
async init() {
|
||||
// Load i18n translations
|
||||
await I18n.loadModule('marketplace');
|
||||
|
||||
// Guard against multiple initialization
|
||||
if (window._vendorLetzshopInitialized) {
|
||||
return;
|
||||
@@ -196,7 +199,7 @@ function vendorLetzshop() {
|
||||
*/
|
||||
async importOrders() {
|
||||
if (!this.status.is_configured) {
|
||||
this.error = 'Please configure your API key first';
|
||||
this.error = I18n.t('marketplace.messages.please_configure_api_key_first');
|
||||
this.activeTab = 'settings';
|
||||
return;
|
||||
}
|
||||
@@ -229,7 +232,7 @@ function vendorLetzshop() {
|
||||
*/
|
||||
async saveCredentials() {
|
||||
if (!this.credentialsForm.api_key && !this.credentials) {
|
||||
this.error = 'Please enter an API key';
|
||||
this.error = I18n.t('marketplace.messages.please_enter_api_key');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -288,7 +291,7 @@ function vendorLetzshop() {
|
||||
* Delete credentials
|
||||
*/
|
||||
async deleteCredentials() {
|
||||
if (!confirm('Are you sure you want to remove your Letzshop credentials?')) {
|
||||
if (!confirm(I18n.t('marketplace.confirmations.remove_letzshop_credentials'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -313,7 +316,7 @@ function vendorLetzshop() {
|
||||
* Confirm order
|
||||
*/
|
||||
async confirmOrder(order) {
|
||||
if (!confirm('Confirm this order?')) {
|
||||
if (!confirm(I18n.t('marketplace.confirmations.confirm_order'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -337,7 +340,7 @@ function vendorLetzshop() {
|
||||
* Reject order
|
||||
*/
|
||||
async rejectOrder(order) {
|
||||
if (!confirm('Reject this order? This action cannot be undone.')) {
|
||||
if (!confirm(I18n.t('marketplace.confirmations.reject_order'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -374,7 +377,7 @@ function vendorLetzshop() {
|
||||
*/
|
||||
async submitTracking() {
|
||||
if (!this.trackingForm.tracking_number || !this.trackingForm.tracking_carrier) {
|
||||
this.error = 'Please fill in all fields';
|
||||
this.error = I18n.t('marketplace.messages.please_fill_in_all_fields');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user