feat: add extractor for setup wizard txt files

This commit is contained in:
barredterra
2024-08-17 01:50:55 +02:00
parent 1bdeddcb04
commit 60aaeefd70
2 changed files with 5 additions and 0 deletions

View File

@@ -1,2 +1,3 @@
**/setup/setup_wizard/data/uom_data.json,erpnext.gettext.extractors.uom_data.extract
**/setup/doctype/incoterm/incoterms.csv,erpnext.gettext.extractors.incoterms.extract
**/setup/setup_wizard/data/*.txt,erpnext.gettext.extractors.lines_from_txt_file.extract
1 **/setup/setup_wizard/data/uom_data.json erpnext.gettext.extractors.uom_data.extract
2 **/setup/doctype/incoterm/incoterms.csv erpnext.gettext.extractors.incoterms.extract
3 **/setup/setup_wizard/data/*.txt erpnext.gettext.extractors.lines_from_txt_file.extract

View File

@@ -0,0 +1,4 @@
def extract(fileobj, *args, **kwargs):
"""Split file into lines and yield one translation unit per line."""
for line_no, line in enumerate(fileobj.readlines()):
yield line_no + 1, "_", line.decode().strip(), []