fix: POS string translation (#28381)
diff --git a/erpnext/selling/page/point_of_sale/pos_item_cart.js b/erpnext/selling/page/point_of_sale/pos_item_cart.js
index 9d8338e..b652fdc 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_cart.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js
@@ -49,11 +49,11 @@
this.$component.append(
`<div class="cart-container">
<div class="abs-cart-container">
- <div class="cart-label">Item Cart</div>
+ <div class="cart-label">${__('Item Cart')}</div>
<div class="cart-header">
- <div class="name-header">Item</div>
- <div class="qty-header">Qty</div>
- <div class="rate-amount-header">Amount</div>
+ <div class="name-header">${__('Item')}</div>
+ <div class="qty-header">${__('Quantity')}</div>
+ <div class="rate-amount-header">${__('Amount')}</div>
</div>
<div class="cart-items-section"></div>
<div class="cart-totals-section"></div>
@@ -78,7 +78,7 @@
make_no_items_placeholder() {
this.$cart_header.css('display', 'none');
this.$cart_items_wrapper.html(
- `<div class="no-item-wrapper">No items in cart</div>`
+ `<div class="no-item-wrapper">${__('No items in cart')}</div>`
);
}
@@ -98,19 +98,19 @@
this.$totals_section.append(
`<div class="add-discount-wrapper">
- ${this.get_discount_icon()} Add Discount
+ ${this.get_discount_icon()} ${__('Add Discount')}
</div>
<div class="net-total-container">
- <div class="net-total-label">Net Total</div>
+ <div class="net-total-label">${__("Net Total")}</div>
<div class="net-total-value">0.00</div>
</div>
<div class="taxes-container"></div>
<div class="grand-total-container">
- <div>Grand Total</div>
+ <div>${__('Grand Total')}</div>
<div>0.00</div>
</div>
- <div class="checkout-btn">Checkout</div>
- <div class="edit-cart-btn">Edit Cart</div>`
+ <div class="checkout-btn">${__('Checkout')}</div>
+ <div class="edit-cart-btn">${__('Edit Cart')}</div>`
)
this.$add_discount_elem = this.$component.find(".add-discount-wrapper");
@@ -126,10 +126,10 @@
},
cols: 5,
keys: [
- [ 1, 2, 3, 'Quantity' ],
- [ 4, 5, 6, 'Discount' ],
- [ 7, 8, 9, 'Rate' ],
- [ '.', 0, 'Delete', 'Remove' ]
+ [ 1, 2, 3, __('Quantity') ],
+ [ 4, 5, 6, __('Discount') ],
+ [ 7, 8, 9, __('Rate') ],
+ [ '.', 0, __('Delete'), __('Remove') ]
],
css_classes: [
[ '', '', '', 'col-span-2' ],
@@ -148,7 +148,7 @@
)
this.$numpad_section.append(
- `<div class="numpad-btn checkout-btn" data-button-value="checkout">Checkout</div>`
+ `<div class="numpad-btn checkout-btn" data-button-value="checkout">${__('Checkout')}</div>`
)
}
@@ -386,7 +386,7 @@
'border': '1px dashed var(--gray-500)',
'padding': 'var(--padding-sm) var(--padding-md)'
});
- me.$add_discount_elem.html(`${me.get_discount_icon()} Add Discount`);
+ me.$add_discount_elem.html(`${me.get_discount_icon()} ${__('Add Discount')}`);
me.discount_field = undefined;
}
},
@@ -411,7 +411,7 @@
});
this.$add_discount_elem.html(
`<div class="edit-discount-btn">
- ${this.get_discount_icon()} Additional ${String(discount).bold()}% discount applied
+ ${this.get_discount_icon()} ${__("Additional")} ${String(discount).bold()}% ${__("discount applied")}
</div>`
);
}
@@ -445,7 +445,7 @@
function get_customer_description() {
if (!email_id && !mobile_no) {
- return `<div class="customer-desc">Click to add email / phone</div>`;
+ return `<div class="customer-desc">${__('Click to add email / phone')}</div>`;
} else if (email_id && !mobile_no) {
return `<div class="customer-desc">${email_id}</div>`;
} else if (mobile_no && !email_id) {
@@ -479,22 +479,22 @@
render_net_total(value) {
const currency = this.events.get_frm().doc.currency;
this.$totals_section.find('.net-total-container').html(
- `<div>Net Total</div><div>${format_currency(value, currency)}</div>`
+ `<div>${__('Net Total')}</div><div>${format_currency(value, currency)}</div>`
)
this.$numpad_section.find('.numpad-net-total').html(
- `<div>Net Total: <span>${format_currency(value, currency)}</span></div>`
+ `<div>${__('Net Total')}: <span>${format_currency(value, currency)}</span></div>`
);
}
render_grand_total(value) {
const currency = this.events.get_frm().doc.currency;
this.$totals_section.find('.grand-total-container').html(
- `<div>Grand Total</div><div>${format_currency(value, currency)}</div>`
+ `<div>${__('Grand Total')}</div><div>${format_currency(value, currency)}</div>`
)
this.$numpad_section.find('.numpad-grand-total').html(
- `<div>Grand Total: <span>${format_currency(value, currency)}</span></div>`
+ `<div>${__('Grand Total')}: <span>${format_currency(value, currency)}</span></div>`
);
}
diff --git a/erpnext/selling/page/point_of_sale/pos_item_details.js b/erpnext/selling/page/point_of_sale/pos_item_details.js
index ec861d7..fb69b63 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_details.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_details.js
@@ -28,7 +28,7 @@
init_child_components() {
this.$component.html(
`<div class="item-details-header">
- <div class="label">Item Details</div>
+ <div class="label">${__('Item Details')}</div>
<div class="close-btn">
<svg width="32" height="32" viewBox="0 0 14 14" fill="none">
<path d="M4.93764 4.93759L7.00003 6.99998M9.06243 9.06238L7.00003 6.99998M7.00003 6.99998L4.93764 9.06238L9.06243 4.93759" stroke="#8D99A6"/>
@@ -201,8 +201,9 @@
`<div class="grid-filler no-select"></div>`
);
}
+ const label = __('Auto Fetch Serial Numbers');
this.$form_container.append(
- `<div class="btn btn-sm btn-secondary auto-fetch-btn">Auto Fetch Serial Numbers</div>`
+ `<div class="btn btn-sm btn-secondary auto-fetch-btn">${label}</div>`
);
this.$form_container.find('.serial_no-control').find('textarea').css('height', '6rem');
}
diff --git a/erpnext/selling/page/point_of_sale/pos_item_selector.js b/erpnext/selling/page/point_of_sale/pos_item_selector.js
index 8352b14..4963852 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_selector.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js
@@ -24,7 +24,7 @@
this.wrapper.append(
`<section class="items-selector">
<div class="filter-section">
- <div class="label">All Items</div>
+ <div class="label">${__('All Items')}</div>
<div class="search-field"></div>
<div class="item-group-field"></div>
</div>
diff --git a/erpnext/selling/page/point_of_sale/pos_past_order_list.js b/erpnext/selling/page/point_of_sale/pos_past_order_list.js
index e0993e2..a0475c7 100644
--- a/erpnext/selling/page/point_of_sale/pos_past_order_list.js
+++ b/erpnext/selling/page/point_of_sale/pos_past_order_list.js
@@ -16,7 +16,7 @@
this.wrapper.append(
`<section class="past-order-list">
<div class="filter-section">
- <div class="label">Recent Orders</div>
+ <div class="label">${__('Recent Orders')}</div>
<div class="search-field"></div>
<div class="status-field"></div>
</div>
diff --git a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
index dd9e05a..eeb8523 100644
--- a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
+++ b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
@@ -17,16 +17,16 @@
this.wrapper.append(
`<section class="past-order-summary">
<div class="no-summary-placeholder">
- Select an invoice to load summary data
+ ${__('Select an invoice to load summary data')}
</div>
<div class="invoice-summary-wrapper">
<div class="abs-container">
<div class="upper-section"></div>
- <div class="label">Items</div>
+ <div class="label">${__('Items')}</div>
<div class="items-container summary-container"></div>
- <div class="label">Totals</div>
+ <div class="label">${__('Totals')}</div>
<div class="totals-container summary-container"></div>
- <div class="label">Payments</div>
+ <div class="label">${__('Payments')}</div>
<div class="payments-container summary-container"></div>
<div class="summary-btns"></div>
</div>
@@ -82,7 +82,7 @@
return `<div class="left-section">
<div class="customer-name">${doc.customer}</div>
<div class="customer-email">${this.customer_email}</div>
- <div class="cashier">Sold by: ${doc.owner}</div>
+ <div class="cashier">${__('Sold by')}: ${doc.owner}</div>
</div>
<div class="right-section">
<div class="paid-amount">${format_currency(doc.paid_amount, doc.currency)}</div>
@@ -121,7 +121,7 @@
get_net_total_html(doc) {
return `<div class="summary-row-wrapper">
- <div>Net Total</div>
+ <div>${__('Net Total')}</div>
<div>${format_currency(doc.net_total, doc.currency)}</div>
</div>`;
}
@@ -144,14 +144,14 @@
get_grand_total_html(doc) {
return `<div class="summary-row-wrapper grand-total">
- <div>Grand Total</div>
+ <div>${__('Grand Total')}</div>
<div>${format_currency(doc.grand_total, doc.currency)}</div>
</div>`;
}
get_payment_html(doc, payment) {
return `<div class="summary-row-wrapper payments">
- <div>${payment.mode_of_payment}</div>
+ <div>${__(payment.mode_of_payment)}</div>
<div>${format_currency(payment.amount, doc.currency)}</div>
</div>`;
}
@@ -285,8 +285,9 @@
if (m.condition) {
m.visible_btns.forEach(b => {
const class_name = b.split(' ')[0].toLowerCase();
+ const btn = __(b);
this.$summary_btns.append(
- `<div class="summary-btn btn btn-default ${class_name}-btn">${b}</div>`
+ `<div class="summary-btn btn btn-default ${class_name}-btn">${btn}</div>`
);
});
}
diff --git a/erpnext/selling/page/point_of_sale/pos_payment.js b/erpnext/selling/page/point_of_sale/pos_payment.js
index 7ddbf45..b9b6559 100644
--- a/erpnext/selling/page/point_of_sale/pos_payment.js
+++ b/erpnext/selling/page/point_of_sale/pos_payment.js
@@ -18,11 +18,11 @@
prepare_dom() {
this.wrapper.append(
`<section class="payment-container">
- <div class="section-label payment-section">Payment Method</div>
+ <div class="section-label payment-section">${__('Payment Method')}</div>
<div class="payment-modes"></div>
<div class="fields-numpad-container">
<div class="fields-section">
- <div class="section-label">Additional Information</div>
+ <div class="section-label">${__('Additional Information')}</div>
<div class="invoice-fields"></div>
</div>
<div class="number-pad"></div>
@@ -30,7 +30,7 @@
<div class="totals-section">
<div class="totals"></div>
</div>
- <div class="submit-order-btn">Complete Order</div>
+ <div class="submit-order-btn">${__("Complete Order")}</div>
</section>`
);
this.$component = this.wrapper.find('.payment-container');
@@ -518,12 +518,12 @@
this.$totals.html(
`<div class="col">
- <div class="total-label">Grand Total</div>
+ <div class="total-label">${__('Grand Total')}</div>
<div class="value">${format_currency(grand_total, currency)}</div>
</div>
<div class="seperator-y"></div>
<div class="col">
- <div class="total-label">Paid Amount</div>
+ <div class="total-label">${__('Paid Amount')}</div>
<div class="value">${format_currency(paid_amount, currency)}</div>
</div>
<div class="seperator-y"></div>