js translations refactor

This commit is contained in:
Pratik Vyas
2014-04-14 17:14:23 +05:30
parent b52618c142
commit b0f279a34e
6 changed files with 16 additions and 22 deletions

View File

@@ -274,7 +274,7 @@ erpnext.POS = Class.extend({
if(!me.frm.doc[me.party.toLowerCase()] && ((me.frm.doctype == "Quotation" && if(!me.frm.doc[me.party.toLowerCase()] && ((me.frm.doctype == "Quotation" &&
me.frm.doc.quotation_to == "Customer") me.frm.doc.quotation_to == "Customer")
|| me.frm.doctype != "Quotation")) { || me.frm.doctype != "Quotation")) {
msgprint("Please select " + me.party + " first."); msgprint("Please select {0} first.", [me.party]);
return; return;
} }
else else

View File

@@ -61,11 +61,11 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
var me = this; var me = this;
this.validate_salary_structure(btn, function(r) { this.validate_salary_structure(btn, function(r) {
if(r.message) { if(r.message) {
msgprint(__("Employee") + ' "' + me.frm.doc.name + '": ' msgprint(__("Employee {0}:\
+ __("An active Salary Structure already exists. \ An active Salary Structure already exists. \
If you want to create new one, please ensure that no active \ If you want to create new one, please ensure that no active \
Salary Structure exists for this Employee. \ 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) { } else if(!r.exc) {
frappe.model.map({ frappe.model.map({
source: me.frm.doc, source: me.frm.doc,

View File

@@ -90,8 +90,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
validate_company_and_party: function(party_field) { validate_company_and_party: function(party_field) {
if(!this.frm.doc.quotation_to) { if(!this.frm.doc.quotation_to) {
msgprint(__("Please select a value for" + " " + msgprint(__("Please select a value for {0} quotation_to {1}", [this.frm.doc.doctype, this.frm.doc.name]));
frappe.meta.get_label(this.frm.doc.doctype, "quotation_to", this.frm.doc.name)));
return false; return false;
} else if (this.frm.doc.quotation_to == "Lead") { } else if (this.frm.doc.quotation_to == "Lead") {
return true; return true;

View File

@@ -181,7 +181,6 @@ cur_frm.cscript.image = function() {
if(!cur_frm.doc.description_html) if(!cur_frm.doc.description_html)
cur_frm.cscript.add_image(cur_frm.doc); cur_frm.cscript.add_image(cur_frm.doc);
else { else {
msgprint(__("You may need to update: ") + msgprint(__("You may need to update: {0}", [frappe.meta.get_docfield(cur_frm.doc.doctype, "description_html").label]));
frappe.meta.get_docfield(cur_frm.doc.doctype, "description_html").label);
} }
} }

View File

@@ -78,8 +78,7 @@ cur_frm.cscript.validate_duplicate_items = function(doc, ps_detail) {
} }
} }
if(flt(ps_detail[i].qty)<=0) { if(flt(ps_detail[i].qty)<=0) {
msgprint(__("Invalid quantity specified for item ") + ps_detail[i].item_code + msgprint(__("Invalid quantity specified for item {0}. Quantity should be greater than 0.", [ps_detail[i].item_code]));
"."+__(" Quantity should be greater than 0."));
validated = false; validated = false;
} }
} }
@@ -95,9 +94,7 @@ cur_frm.cscript.calc_net_total_pkg = function(doc, ps_detail) {
for(var i=0; i<ps_detail.length; i++) { for(var i=0; i<ps_detail.length; i++) {
var item = ps_detail[i]; var item = ps_detail[i];
if(item.weight_uom != doc.net_weight_uom) { if(item.weight_uom != doc.net_weight_uom) {
msgprint(__("Different UOM for items will lead to incorrect")+ msgprint(__("Different UOM for items will lead to incorrect (Total) Net Weight value. Make sure that Net Weight of each item is in the same UOM."));
__("(Total) Net Weight value. Make sure that Net Weight of each item is")+
__("in the same UOM."))
validated = false; validated = false;
} }
net_weight_pkg += flt(item.net_weight) * flt(item.qty); net_weight_pkg += flt(item.net_weight) * flt(item.qty);

View File

@@ -63,8 +63,8 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
} }
if(item.qty > item.received_qty) { if(item.qty > item.received_qty) {
msgprint(__("Error") + ": " + __(frappe.meta.get_label(item.doctype, "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))); __(frappe.meta.get_label(item.doctype, "received_qty", item.name))]))
item.qty = item.rejected_qty = 0.0; item.qty = item.rejected_qty = 0.0;
} else { } else {
item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item)); 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"]); frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
if(item.rejected_qty > item.received_qty) { if(item.rejected_qty > item.received_qty) {
msgprint(__("Error") + ": " + msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "rejected_qty", item.name)),
__(frappe.meta.get_label(item.doctype, "rejected_qty", item.name)) __(frappe.meta.get_label(item.doctype, "received_qty", item.name))]));
+ " > " + __(frappe.meta.get_label(item.doctype, "received_qty", item.name)));
item.qty = item.rejected_qty = 0.0; item.qty = item.rejected_qty = 0.0;
} else { } else {
item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item)); item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item));