Skip to content

Commit

Permalink
fix: extract incoterm titles as translatable strings
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Aug 7, 2024
1 parent 47c2127 commit e177ece
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions babel_extractors.csv
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/setup/setup_wizard/data/uom_data.json,erpnext.gettext.extractors.uom_data.extract
**/setup/doctype/incoterm/incoterms.csv,erpnext.gettext.extractors.incoterms.extract
10 changes: 10 additions & 0 deletions erpnext/gettext/extractors/incoterms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from csv import DictReader
from io import StringIO


def extract(fileobj, *args, **kwargs):
"""Extract incoterm titles from a CSV file."""
file = StringIO(fileobj.read().decode()) # CSV reader expects a text file
reader = DictReader(file)
for i, row in enumerate(reader):
yield i + 2, "_", row["title"], ["Title of an incoterm"]

0 comments on commit e177ece

Please sign in to comment.