Files
schuetz3-erpnext/erpnext/gettext/extractors/uom_data.py
2024-03-25 23:19:13 +01:00

18 lines
422 B
Python

import json
def extract(fileobj, *args, **kwargs):
"""
Extract messages from a JSON file with standard UOM data. To be used by the Babel extractor.
:param fileobj: the file-like object the messages should be extracted from
:rtype: `iterator`
"""
uom_list = json.load(fileobj)
if not isinstance(uom_list, list):
return
for uom_data in uom_list:
yield None, "_", uom_data.get("uom_name"), ["Name of a UOM"]