Skip to content

Commit 82882cb

Browse files
committed
Fixed type check for i18n (macro is optional)
1 parent 8a80e6a commit 82882cb

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/zimscraperlib/i18n.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,9 @@ def replace_types(new_type: str) -> str:
111111
)
112112
lang_data.update({"english": isolang.name, "iso_types": iso_types})
113113

114-
if isolang.macro():
115-
return (
116-
lang_data,
117-
get_iso_lang_data(isolang.macro().name)[0],
118-
) # first item in the returned tuple
119-
return lang_data, None
114+
# first item in the returned tuple
115+
macro = isolang.macro()
116+
return (lang_data, get_iso_lang_data(macro.name)[0] if macro else None)
120117

121118

122119
def find_language_names(query: str, lang_data: Lang | None = None) -> tuple[str, str]:

0 commit comments

Comments
 (0)