Skip to content

Commit

Permalink
ebooks: Fix do_json languages
Browse files Browse the repository at this point in the history
Co-Authored-by: Peter Weber <[email protected]>
  • Loading branch information
rerowep committed Nov 14, 2024
1 parent 1fdc0fb commit 712b563
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def do_language(data, marc21):
lang_codes = [v.get("value") for v in language]
if marc21.lang_from_008:
lang_value = marc21.lang_from_008
if lang_value != "|||" and lang_value not in lang_codes:
if lang_value not in ["|||", "###", " "] and lang_value not in lang_codes:
language.append({"value": lang_value, "type": "bf:Language"})
lang_codes.append(marc21.lang_from_008)
for lang_value in marc21.langs_from_041_a:
Expand Down
3 changes: 3 additions & 0 deletions rero_ils/modules/ebooks/dojson/contrib/marc21/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def marc21_to_translated_from(self, key, value):
if lang not in unique_lang:
unique_lang.append(lang)
languages.append({"type": "bf:Language", "value": lang})
if not languages:
# if we don't have language set one language as undefined
languages = [{"type": "bf:Language", "value": "und"}]

return languages

Expand Down

0 comments on commit 712b563

Please sign in to comment.