From 0271166403836ddf8d24a0a2360cec9ce1da2e26 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Sat, 4 Jan 2020 17:53:20 -0500 Subject: [PATCH] add iso2 index to iiab_lib.py --- roles/2-common/templates/iiab_lib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/2-common/templates/iiab_lib.py b/roles/2-common/templates/iiab_lib.py index 71b71be2f..afca02edf 100644 --- a/roles/2-common/templates/iiab_lib.py +++ b/roles/2-common/templates/iiab_lib.py @@ -10,6 +10,7 @@ import xml.etree.ElementTree as ET import iiab.iiab_const as CONST lang_codes = {} +lang_iso2_codes = {} def get_zim_list(path): ''' @@ -139,8 +140,11 @@ def read_lang_codes(): #print("menu.json:%s"%reads) lang_codes = json.loads(reads) -# there is a different algorithm in get_zim_list above + # create iso2 index + for lang in lang_codes: + lang_iso2_codes[lang_codes[lang]['iso2'] ] = lang +# there is a different algorithm in get_zim_list above def calc_perma_ref(uri): '''Given a path or url return the generic zim name''' url_slash = uri.split('/')