fix: added translation for fielname labels shown in filter, sort & columns

This commit is contained in:
Shariq Ansari 2024-04-15 21:33:17 +05:30
parent 28a6181197
commit 49ef15883d

View File

@ -14,7 +14,7 @@ def sort_options(doctype: str):
fields = [field for field in fields if field.fieldtype not in no_value_fields] fields = [field for field in fields if field.fieldtype not in no_value_fields]
fields = [ fields = [
{ {
"label": field.label, "label": _(field.label),
"value": field.fieldname, "value": field.fieldname,
} }
for field in fields for field in fields
@ -30,6 +30,7 @@ def sort_options(doctype: str):
] ]
for field in standard_fields: for field in standard_fields:
field["label"] = _(field["label"])
fields.append(field) fields.append(field)
return fields return fields
@ -102,6 +103,9 @@ def get_filterable_fields(doctype: str):
field["name"] = field.get("fieldname") field["name"] = field.get("fieldname")
res.append(field) res.append(field)
for field in res:
field["label"] = _(field.get("label"))
return res return res
def get_fields_meta(DocField, doctype, allowed_fieldtypes, restricted_fields): def get_fields_meta(DocField, doctype, allowed_fieldtypes, restricted_fields):
@ -199,7 +203,7 @@ def get_list_data(
fields = [field for field in fields if field.fieldtype not in no_value_fields] fields = [field for field in fields if field.fieldtype not in no_value_fields]
fields = [ fields = [
{ {
"label": field.label, "label": _(field.label),
"type": field.fieldtype, "type": field.fieldtype,
"value": field.fieldname, "value": field.fieldname,
"options": field.options, "options": field.options,
@ -226,6 +230,7 @@ def get_list_data(
if field.get('value') not in rows: if field.get('value') not in rows:
rows.append(field.get('value')) rows.append(field.get('value'))
if field not in fields: if field not in fields:
field["label"] = _(field["label"])
fields.append(field) fields.append(field)
if not is_default and custom_view_name: if not is_default and custom_view_name: