fix: translations for fields in webform list (#8027)

* fix: translation for webform list

* chore: added Sr to translated items
This commit is contained in:
Shivam Mishra 2019-07-29 15:15:55 +05:30 committed by Anurag Mishra
parent dfa16a77f4
commit f37fbbba88
2 changed files with 5 additions and 6 deletions

View file

@ -151,12 +151,9 @@ export default class WebFormList {
th.appendChild(checkbox);
row.appendChild(th);
add_heading(row, "Sr.");
add_heading(row, __("Sr"));
this.columns.forEach(col => {
let th = document.createElement("th");
let text = document.createTextNode(__(col.label));
th.appendChild(text);
row.appendChild(th);
add_heading(row, __(col.label));
});
function add_heading(row, label) {
@ -301,7 +298,7 @@ frappe.ui.WebFormListRow = class WebFormListRow {
let cell = this.row.insertCell();
let formatter = frappe.form.get_formatter(field.fieldtype);
cell.innerHTML = this.doc[field.fieldname] &&
formatter(this.doc[field.fieldname], field, {only_value: 1}, this.doc) || "";
__(formatter(this.doc[field.fieldname], field, {only_value: 1}, this.doc)) || "";
});
this.row.onclick = () => this.events.onEdit();

View file

@ -177,6 +177,8 @@ def get_context(context):
def load_translations(self, context):
translated_messages = frappe.translate.get_dict('doctype', self.doc_type)
# Sr is not added by default, had to be added manually
translated_messages['Sr'] = _('Sr')
context.translated_messages = frappe.as_json(translated_messages)
def load_document(self, context):