feat: report extractor
This commit is contained in:
parent
6b1e12e49b
commit
abcafafca9
1 changed files with 18 additions and 0 deletions
18
frappe/gettext/extractors/report.py
Normal file
18
frappe/gettext/extractors/report.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import json
|
||||
|
||||
|
||||
def extract(fileobj, *args, **kwargs):
|
||||
"""
|
||||
Extract messages from report JSON files. To be used to babel extractor
|
||||
:param fileobj: the file-like object the messages should be extracted from
|
||||
:rtype: `iterator`
|
||||
"""
|
||||
data = json.load(fileobj)
|
||||
|
||||
if isinstance(data, list):
|
||||
return
|
||||
|
||||
if data.get("doctype") != "Report":
|
||||
return
|
||||
|
||||
yield None, "_", data.get("report_name"), ["Name of a report"]
|
||||
Loading…
Add table
Reference in a new issue