Skip to content

Commit

Permalink
prevent to-offspot fromm including entries with empty language
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Dec 17, 2022
1 parent 49f80d8 commit 5eb83e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions zim/library-mgmt/library-to-offspot.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ def ga(k, t=text_type):
# find ISO 639-1 from ISO 639-3 (might not exist)
if re.search(r"[^a-z]", lang_3) is not None:
lang_3 = re.split(r"[^a-z]", lang_3, 1)[0]

# skip content that resulted in empty lang_3
if not lang_3:
continue

try:
lang_1 = pycountry.languages.get(
**{"alpha_{}".format(len(lang_3)): lang_3}
Expand Down

0 comments on commit 5eb83e5

Please sign in to comment.