nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.31k stars 5.33k forks source link

OrderNote is not translatable #5758

Closed reader-man closed 3 years ago

reader-man commented 3 years ago

nopCommerce version: 4.40.3

Steps to reproduce the problem: if you search in code for the following lines:

new OrderNote
AddOrderNoteAsync

you will get 52 messages that are not translatable.

suggestion: i think, that "OrderNote" object, should get its messages from a localization table in the DB, to ease the translation for multi-lingual sites.

e.g.:

Note = "Order placed",
Note = "Order paid",
Note = "Order shipped",
Note = "Order delivered",
Note = "Recurring payment has been cancelled",
Note = "PayPal PDT failed. " + response,
Note = "Credit card info has been edited",
Note = "Order totals have been edited",
Note = "Shipping method has been edited",
Note = "Order item has been edited",
Note = "Order item has been deleted",
Note = "A new order item has been added",
Note = "Address has been edited",
Note = "A shipment has been added",
Note = "A shipment has been deleted",
Note = $"Unable to cancel recurring payment. {error}",
Note = $"Webhook details: {System.Environment.NewLine}{rawRequestString}",
Note = $"Order status has been edited. New status: {await _localizationService.GetLocalizedEnumAsync(order.OrderStatus)}",
var errorStr = $"PayPal PDT. Returned order total {mcGross} doesn't equal order total {order.OrderTotal}. Order# {order.Id}.";
var errorStr = $"PayPal IPN. Returned order total {mcGross} doesn't equal order total {order.OrderTotal}. Order# {order.Id}.";
await AddOrderNoteAsync(order, "Order has been async Tasked");
await AddOrderNoteAsync(order, "Order has been cancelled");
await AddOrderNoteAsync(order, "Order has been captured");
await AddOrderNoteAsync(order, "Order has been deleted");
await AddOrderNoteAsync(order, "Order has been marked as async Tasked");
await AddOrderNoteAsync(order, "Order has been marked as authorized");
await AddOrderNoteAsync(order, "Order has been marked as paid");
await AddOrderNoteAsync(order, $"\"Delivered\" email (to customer) has been queued. Queued email identifiers: {string.Join(", ", queuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order cancelled\" email (to customer) has been queued. Queued email identifiers: {string.Join(", ", orderCancelledCustomerNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order completed\" email (to customer) has been queued. Queued email identifiers: {string.Join(", ", orderCompletedCustomerNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order paid\" email (to affiliate) has been queued. Queued email identifiers: {string.Join(", ", orderPaidAffiliateNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order paid\" email (to customer) has been queued. Queued email identifiers: {string.Join(", ", orderPaidCustomerNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order paid\" email (to store owner) has been queued. Queued email identifiers: {string.Join(", ", orderPaidStoreOwnerNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order paid\" email (to vendor) has been queued. Queued email identifiers: {string.Join(", ", orderPaidVendorNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order placed\" email (to affiliate) has been queued. Queued email identifiers: {string.Join(", ", orderPlacedAffiliateNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order placed\" email (to customer) has been queued. Queued email identifiers: {string.Join(", ", orderPlacedCustomerNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order placed\" email (to store owner) has been queued. Queued email identifiers: {string.Join(", ", orderPlacedStoreOwnerNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order placed\" email (to vendor) has been queued. Queued email identifiers: {string.Join(", ", orderPlacedVendorNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order refunded\" email (to customer) has been queued. Queued email identifiers: {string.Join(", ", orderRefundedCustomerNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Order refunded\" email (to store owner) has been queued. Queued email identifiers: {string.Join(", ", orderRefundedStoreOwnerNotificationQueuedEmailIds)}.");
await AddOrderNoteAsync(order, $"\"Shipped\" email (to customer) has been queued. Queued email identifiers: {string.Join(", ", queuedEmailIds)}.");
await AddOrderNoteAsync(order, $"Order has been marked as partially refunded. Amount = {amountToRefund}");
await AddOrderNoteAsync(order, $"Order has been marked as refunded. Amount = {amountToRefund}");
await AddOrderNoteAsync(order, $"Order has been partially refunded. Amount = {amountToRefund}");
await AddOrderNoteAsync(order, $"Order has been refunded. Amount = {request.AmountToRefund}");
await AddOrderNoteAsync(order, $"Order status has been changed to {await _localizationService.GetLocalizedEnumAsync(os)}");
await AddOrderNoteAsync(order, $"Shipment# {shipment.Id} has been delivered");
await AddOrderNoteAsync(order, $"Shipment# {shipment.Id} has been sent");
await AddOrderNoteAsync(order, $"Unable to async Tasking order. {error}");
await AddOrderNoteAsync(order, $"Unable to capture order. {error}");
await AddOrderNoteAsync(order, $"Unable to partially refund order. {error}");
await AddOrderNoteAsync(order, $"Unable to refund order. {error}");
AndreiMaz commented 3 years ago

also related to https://github.com/nopSolutions/nopCommerce/issues/2158

reader-man commented 3 years ago

hi, how about if you make them like this: Note = await _localizationService.GetResourceAsync("############") AddOrderNoteAsync(order, await _localizationService.GetResourceAsync("############")

Regards.

AndreiMaz commented 3 years ago

After some consideration we've decided not to implement this functionality