feat: add translatable string extractor for UOM names
This commit is contained in:
1
babel_extractors.csv
Normal file
1
babel_extractors.csv
Normal file
@@ -0,0 +1 @@
|
|||||||
|
**/setup/setup_wizard/data/uom_data.json,erpnext.gettext.extractors.uom_data.extract
|
||||||
|
0
erpnext/gettext/__init__.py
Normal file
0
erpnext/gettext/__init__.py
Normal file
0
erpnext/gettext/extractors/__init__.py
Normal file
0
erpnext/gettext/extractors/__init__.py
Normal file
17
erpnext/gettext/extractors/uom_data.py
Normal file
17
erpnext/gettext/extractors/uom_data.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
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"]
|
||||||
Reference in New Issue
Block a user