From 06e2e0ea1f7ecbc8ab6065a0283e0fd90b7d2e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20J=C3=A4rventaus?= Date: Fri, 1 Dec 2023 12:07:13 +0200 Subject: [PATCH] Do not add null "code" fields 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. --- src/wiktextract/translations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wiktextract/translations.py b/src/wiktextract/translations.py index 090423f6..bad07edf 100644 --- a/src/wiktextract/translations.py +++ b/src/wiktextract/translations.py @@ -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: