seitime-frappe/frappe/gettext/extractors/report.py
2023-10-15 20:26:46 +02:00

18 lines
408 B
Python

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"]