chore: rewrite user-facing JS messages in Selling module

Conservative cleanup of frappe.throw/msgprint messages per the message style
guide; meaning, severity, and .format() arguments are unchanged:

- index bare {} placeholders as {0}/{1}/... so translators can reorder
- move f-strings / .format() / concatenation out of _() (they break gettext
  extraction and never translate)
- wrap translatable dynamic values (DocType/Select labels) in _()
- fix grammar and colloquialisms
- drop no-op _() wrapping runtime-built strings

Part of #53976.
This commit is contained in:
Mihir Kandoi
2026-06-25 17:26:47 +05:30
parent b0887e03fe
commit c5e911dd07
6 changed files with 8 additions and 8 deletions

View File

@@ -279,7 +279,7 @@ frappe.ui.form.on("Customer", {
error: function () { error: function () {
dialog.hide(); dialog.hide();
frappe.msgprint({ frappe.msgprint({
message: __("Linking to Supplier Failed. Please try again."), message: __("Linking to Supplier failed. Please try again."),
title: __("Linking Failed"), title: __("Linking Failed"),
indicator: "red", indicator: "red",
}); });

View File

@@ -1365,7 +1365,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
primary_action: function () { primary_action: function () {
var data = { items: d.fields_dict.items.grid.get_selected_children() }; var data = { items: d.fields_dict.items.grid.get_selected_children() };
if (!data.items.length) { if (!data.items.length) {
frappe.throw(__("Please select atleast one item to continue")); frappe.throw(__("Please select at least one item to continue"));
} }
me.frm.call({ me.frm.call({
method: "make_work_orders", method: "make_work_orders",
@@ -1753,7 +1753,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
let selected_items = dialog.fields_dict.items_for_po.grid.get_selected_children(); let selected_items = dialog.fields_dict.items_for_po.grid.get_selected_children();
if (selected_items.length == 0) { if (selected_items.length == 0) {
frappe.throw({ frappe.throw({
message: "Please select Items from the Table", message: __("Please select Items from the Table"),
title: __("Items Required"), title: __("Items Required"),
indicator: "blue", indicator: "blue",
}); });

View File

@@ -824,7 +824,7 @@ erpnext.PointOfSale.Controller = class {
} else if (is_stock_item && available_qty < qty_needed) { } else if (is_stock_item && available_qty < qty_needed) {
frappe.throw({ frappe.throw({
message: __( message: __(
"Stock quantity not enough for Item Code: {0} under warehouse {1}. Available quantity {2} {3}.", "Stock quantity is not enough for Item Code: {0} under warehouse {1}. Available quantity {2} {3}.",
[bold_item_code, bold_warehouse, bold_available_qty, bold_uom] [bold_item_code, bold_warehouse, bold_available_qty, bold_uom]
), ),
indicator: "orange", indicator: "orange",

View File

@@ -201,7 +201,7 @@ erpnext.PointOfSale.PastOrderSummary = class {
frappe.msgprint({ frappe.msgprint({
title: __("Invalid Return"), title: __("Invalid Return"),
indicator: "orange", indicator: "orange",
message: __("All the items have been already returned."), message: __("All the items have already been returned."),
}); });
return; return;
} }

View File

@@ -278,7 +278,7 @@ erpnext.PointOfSale.Payment = class {
) { ) {
const message = items.length const message = items.length
? __("You cannot submit the order without payment.") ? __("You cannot submit the order without payment.")
: __("You cannot submit empty order."); : __("You cannot submit an empty order.");
frappe.show_alert({ message, indicator: "orange" }); frappe.show_alert({ message, indicator: "orange" });
frappe.utils.play_sound("error"); frappe.utils.play_sound("error");
return; return;
@@ -592,7 +592,7 @@ erpnext.PointOfSale.Payment = class {
flt(loyalty_points) * flt(conversion_factor), flt(loyalty_points) * flt(conversion_factor),
precision("loyalty_amount", doc) precision("loyalty_amount", doc)
); );
description = __("You can redeem upto {0}.", [format_currency(max_redeemable_amount)]); description = __("You can redeem up to {0}.", [format_currency(max_redeemable_amount)]);
read_only = false; read_only = false;
} }

View File

@@ -111,7 +111,7 @@ erpnext.SalesFunnel = class SalesFunnel {
get_data(btn) { get_data(btn) {
var me = this; var me = this;
if (!this.company) { if (!this.company) {
frappe.throw(__("Please Select a Company.")); frappe.throw(__("Please select a company."));
} }
const method_map = { const method_map = {