Skip to content

Commit

Permalink
feat: add extractor for setup wizard txt files
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Aug 16, 2024
1 parent 1bdeddc commit 60aaeef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions babel_extractors.csv
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions erpnext/gettext/extractors/lines_from_txt_file.py
Original file line number Diff line number Diff line change
@@ -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(), []

0 comments on commit 60aaeef

Please sign in to comment.