Skip to content

Commit

Permalink
Do not add null "code" fields
Browse files Browse the repository at this point in the history
To keep file-sizes small, and then consistency, we try
to avoid adding json data where the field values are
`null`, and then use .get() instead of index to access
values.

This one slipped through, and only in about 50 entries,
for translation item data.
  • Loading branch information
kristian-clausal committed Dec 1, 2023
1 parent 2156084 commit 06e2e0e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/wiktextract/translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ def parse_translation_item_text(wxr, word, data, item, sense, pos_datas,
continue

# Strip language links
tr = {"lang": lang, "code": langcode}
tr = {"lang": lang}
if langcode:
tr["code"] = langcode
if tags:
tr["tags"] = list(tags)
for t in tagsets:
Expand Down

0 comments on commit 06e2e0e

Please sign in to comment.