fix: exclude some untranslatable select options
This commit is contained in:
parent
97798303d5
commit
1a1cdf21bf
1 changed files with 13 additions and 1 deletions
|
|
@ -1,5 +1,13 @@
|
|||
import json
|
||||
|
||||
EXCLUDE_SELECT_OPTIONS = [
|
||||
"naming_series",
|
||||
"number_format",
|
||||
"float_precision",
|
||||
"currency_precision",
|
||||
"minimum_password_score",
|
||||
]
|
||||
|
||||
|
||||
def extract(fileobj, *args, **kwargs):
|
||||
"""
|
||||
|
|
@ -26,13 +34,14 @@ def extract(fileobj, *args, **kwargs):
|
|||
|
||||
for field in fields:
|
||||
fieldtype = field.get("fieldtype")
|
||||
fieldname = field.get("fieldname")
|
||||
label = field.get("label")
|
||||
|
||||
if label:
|
||||
messages.append((label, f"Label of a {fieldtype} field in DocType '{doctype}'"))
|
||||
_label = label
|
||||
else:
|
||||
_label = field.get("fieldname")
|
||||
_label = fieldname
|
||||
|
||||
if description := field.get("description"):
|
||||
messages.append(
|
||||
|
|
@ -41,6 +50,9 @@ def extract(fileobj, *args, **kwargs):
|
|||
|
||||
if message := field.get("options"):
|
||||
if fieldtype == "Select":
|
||||
if fieldname in EXCLUDE_SELECT_OPTIONS:
|
||||
continue
|
||||
|
||||
select_options = [option for option in message.split("\n") if option and not option.isdigit()]
|
||||
|
||||
if select_options and "icon" in select_options[0]:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue