mirror of https://gitlab.com/bashrc2/epicyon
Use translated event categories
parent
1ba8880cb5
commit
f41e71e552
13
maps.py
13
maps.py
|
@ -113,7 +113,7 @@ def _get_location_from_tags(tags: []) -> str:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _get_category_from_tags(tags: []) -> str:
|
def _get_category_from_tags(tags: [], translate: {}) -> str:
|
||||||
"""Returns the location category from the tags list
|
"""Returns the location category from the tags list
|
||||||
"""
|
"""
|
||||||
evnt = _get_event_dict_from_tags(tags)
|
evnt = _get_event_dict_from_tags(tags)
|
||||||
|
@ -121,15 +121,18 @@ def _get_category_from_tags(tags: []) -> str:
|
||||||
if evnt.get('category'):
|
if evnt.get('category'):
|
||||||
if isinstance(evnt['category'], str):
|
if isinstance(evnt['category'], str):
|
||||||
category_str = remove_html(evnt['category'])
|
category_str = remove_html(evnt['category'])
|
||||||
return category_str
|
if translate.get(category_str):
|
||||||
|
return translate[category_str]
|
||||||
if isinstance(evnt['category'], list):
|
if isinstance(evnt['category'], list):
|
||||||
category_str = ''
|
category_str = ''
|
||||||
for category_item in evnt['category']:
|
for category_item in evnt['category']:
|
||||||
if not isinstance(category_item, str):
|
if not isinstance(category_item, str):
|
||||||
continue
|
continue
|
||||||
|
if not translate.get(category_item):
|
||||||
|
continue
|
||||||
if category_item:
|
if category_item:
|
||||||
category_str += ', '
|
category_str += ', '
|
||||||
category_str += category_item
|
category_str += translate[category_item]
|
||||||
return category_str
|
return category_str
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -296,7 +299,7 @@ def get_location_from_post(post_json_object: {}) -> str:
|
||||||
return locn
|
return locn
|
||||||
|
|
||||||
|
|
||||||
def get_category_from_post(post_json_object: {}) -> str:
|
def get_category_from_post(post_json_object: {}, translate: {}) -> str:
|
||||||
"""Returns the location category for the given post
|
"""Returns the location category for the given post
|
||||||
"""
|
"""
|
||||||
catstr = ''
|
catstr = ''
|
||||||
|
@ -307,7 +310,7 @@ def get_category_from_post(post_json_object: {}) -> str:
|
||||||
post_obj = post_json_object['object']
|
post_obj = post_json_object['object']
|
||||||
if post_obj.get('tag'):
|
if post_obj.get('tag'):
|
||||||
if isinstance(post_obj['tag'], list):
|
if isinstance(post_obj['tag'], list):
|
||||||
catstr = _get_category_from_tags(post_obj['tag'])
|
catstr = _get_category_from_tags(post_obj['tag'], translate)
|
||||||
|
|
||||||
return catstr
|
return catstr
|
||||||
|
|
||||||
|
|
|
@ -3189,7 +3189,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
buy_links = get_buy_links(post_json_object, translate, buy_sites)
|
buy_links = get_buy_links(post_json_object, translate, buy_sites)
|
||||||
# show embedded map if the location contains a map url
|
# show embedded map if the location contains a map url
|
||||||
location_str = get_location_from_post(post_json_object)
|
location_str = get_location_from_post(post_json_object)
|
||||||
category_str = get_category_from_post(post_json_object)
|
category_str = get_category_from_post(post_json_object, translate)
|
||||||
time_span_str = get_event_time_span_from_post(post_json_object)
|
time_span_str = get_event_time_span_from_post(post_json_object)
|
||||||
|
|
||||||
loc_str = location_str
|
loc_str = location_str
|
||||||
|
|
Loading…
Reference in New Issue