From b0f279a34e880550029221120a4c78a09c16cbaf Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Mon, 14 Apr 2014 17:14:23 +0530 Subject: [PATCH] js translations refactor --- erpnext/accounts/doctype/sales_invoice/pos.js | 4 ++-- erpnext/hr/doctype/employee/employee.js | 6 +++--- erpnext/selling/doctype/quotation/quotation.js | 5 ++--- erpnext/stock/doctype/item/item.js | 3 +-- erpnext/stock/doctype/packing_slip/packing_slip.js | 9 +++------ .../doctype/purchase_receipt/purchase_receipt.js | 11 +++++------ 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.js b/erpnext/accounts/doctype/sales_invoice/pos.js index a0da5e65ae..9e81f775be 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.js +++ b/erpnext/accounts/doctype/sales_invoice/pos.js @@ -274,7 +274,7 @@ erpnext.POS = Class.extend({ if(!me.frm.doc[me.party.toLowerCase()] && ((me.frm.doctype == "Quotation" && me.frm.doc.quotation_to == "Customer") || me.frm.doctype != "Quotation")) { - msgprint("Please select " + me.party + " first."); + msgprint("Please select {0} first.", [me.party]); return; } else @@ -605,4 +605,4 @@ erpnext.POS = Class.extend({ }); } }, -}); \ No newline at end of file +}); diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js index 7dccf14d70..e91435e31a 100644 --- a/erpnext/hr/doctype/employee/employee.js +++ b/erpnext/hr/doctype/employee/employee.js @@ -61,11 +61,11 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({ var me = this; this.validate_salary_structure(btn, function(r) { if(r.message) { - msgprint(__("Employee") + ' "' + me.frm.doc.name + '": ' - + __("An active Salary Structure already exists. \ + msgprint(__("Employee {0}:\ + An active Salary Structure already exists. \ If you want to create new one, please ensure that no active \ Salary Structure exists for this Employee. \ - Go to the active Salary Structure and set \"Is Active\" = \"No\"")); + Go to the active Salary Structure and set \"Is Active\" = \"No\"", [me.frm.doc.name])); } else if(!r.exc) { frappe.model.map({ source: me.frm.doc, diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 218c3e12ba..7eeb69a952 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -90,8 +90,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ validate_company_and_party: function(party_field) { if(!this.frm.doc.quotation_to) { - msgprint(__("Please select a value for" + " " + - frappe.meta.get_label(this.frm.doc.doctype, "quotation_to", this.frm.doc.name))); + msgprint(__("Please select a value for {0} quotation_to {1}", [this.frm.doc.doctype, this.frm.doc.name])); return false; } else if (this.frm.doc.quotation_to == "Lead") { return true; @@ -166,4 +165,4 @@ cur_frm.cscript['Declare Order Lost'] = function(){ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { if(cint(frappe.boot.notification_settings.quotation)) cur_frm.email_doc(frappe.boot.notification_settings.quotation_message); -} \ No newline at end of file +} diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index ce92934678..6037c23448 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -181,7 +181,6 @@ cur_frm.cscript.image = function() { if(!cur_frm.doc.description_html) cur_frm.cscript.add_image(cur_frm.doc); else { - msgprint(__("You may need to update: ") + - frappe.meta.get_docfield(cur_frm.doc.doctype, "description_html").label); + msgprint(__("You may need to update: {0}", [frappe.meta.get_docfield(cur_frm.doc.doctype, "description_html").label])); } } diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.js b/erpnext/stock/doctype/packing_slip/packing_slip.js index dd7ba0b15a..2f0bd81b12 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.js +++ b/erpnext/stock/doctype/packing_slip/packing_slip.js @@ -78,8 +78,7 @@ cur_frm.cscript.validate_duplicate_items = function(doc, ps_detail) { } } if(flt(ps_detail[i].qty)<=0) { - msgprint(__("Invalid quantity specified for item ") + ps_detail[i].item_code + - "."+__(" Quantity should be greater than 0.")); + msgprint(__("Invalid quantity specified for item {0}. Quantity should be greater than 0.", [ps_detail[i].item_code])); validated = false; } } @@ -95,9 +94,7 @@ cur_frm.cscript.calc_net_total_pkg = function(doc, ps_detail) { for(var i=0; i' + make_row('Gross Weight', doc.gross_weight_pkg) + '' -} \ No newline at end of file +} diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index e9008473ca..ac90ec15e2 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -63,8 +63,8 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend } if(item.qty > item.received_qty) { - msgprint(__("Error") + ": " + __(frappe.meta.get_label(item.doctype, "qty", item.name)) - + " > " + __(frappe.meta.get_label(item.doctype, "received_qty", item.name))); + msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "qty", item.name)), + __(frappe.meta.get_label(item.doctype, "received_qty", item.name))])) item.qty = item.rejected_qty = 0.0; } else { item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item)); @@ -78,9 +78,8 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]); if(item.rejected_qty > item.received_qty) { - msgprint(__("Error") + ": " + - __(frappe.meta.get_label(item.doctype, "rejected_qty", item.name)) - + " > " + __(frappe.meta.get_label(item.doctype, "received_qty", item.name))); + msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "rejected_qty", item.name)), + __(frappe.meta.get_label(item.doctype, "received_qty", item.name))])); item.qty = item.rejected_qty = 0.0; } else { item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item)); @@ -170,4 +169,4 @@ cur_frm.fields_dict.purchase_receipt_details.grid.get_field("qa_no").get_query = cur_frm.cscript.on_submit = function(doc, cdt, cdn) { if(cint(frappe.boot.notification_settings.purchase_receipt)) cur_frm.email_doc(frappe.boot.notification_settings.purchase_receipt_message); -} \ No newline at end of file +}