-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: extract incoterm titles as translatable strings
- Loading branch information
1 parent
47c2127
commit e177ece
Showing
2 changed files
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |