mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
d177997063
commit
d90fd16128
6
blog.py
6
blog.py
|
@ -268,11 +268,11 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
personUrl = local_actor_url(http_prefix, nickname, domain_full)
|
||||
actor_json = \
|
||||
getPersonFromCache(base_dir, personUrl, person_cache, False)
|
||||
languagesUnderstood = []
|
||||
languages_understood = []
|
||||
if actor_json:
|
||||
languagesUnderstood = get_actor_languages_list(actor_json)
|
||||
languages_understood = get_actor_languages_list(actor_json)
|
||||
jsonContent = get_content_from_post(post_json_object, system_language,
|
||||
languagesUnderstood)
|
||||
languages_understood)
|
||||
if jsonContent:
|
||||
contentStr = addEmbeddedElements(translate, jsonContent,
|
||||
peertube_instances)
|
||||
|
|
|
@ -111,10 +111,10 @@ def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
|
|||
if not actor_json:
|
||||
print('WARN: unable to load actor to check languages ' + personUrl)
|
||||
return False
|
||||
languagesUnderstood = get_actor_languages_list(actor_json)
|
||||
if not languagesUnderstood:
|
||||
languages_understood = get_actor_languages_list(actor_json)
|
||||
if not languages_understood:
|
||||
return True
|
||||
for lang in languagesUnderstood:
|
||||
for lang in languages_understood:
|
||||
if msgObject['contentMap'].get(lang):
|
||||
return True
|
||||
# is the language for this post supported by libretranslate?
|
||||
|
|
4
utils.py
4
utils.py
|
@ -78,7 +78,7 @@ def get_actor_languages_list(actor_json: {}) -> []:
|
|||
|
||||
|
||||
def get_content_from_post(post_json_object: {}, system_language: str,
|
||||
languagesUnderstood: []) -> str:
|
||||
languages_understood: []) -> str:
|
||||
"""Returns the content from the post in the given language
|
||||
including searching for a matching entry within contentMap
|
||||
"""
|
||||
|
@ -97,7 +97,7 @@ def get_content_from_post(post_json_object: {}, system_language: str,
|
|||
else:
|
||||
# is there a contentMap entry for one of
|
||||
# the understood languages?
|
||||
for lang in languagesUnderstood:
|
||||
for lang in languages_understood:
|
||||
if thisPostJson['contentMap'].get(lang):
|
||||
return thisPostJson['contentMap'][lang]
|
||||
else:
|
||||
|
|
|
@ -1852,11 +1852,11 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
personUrl = local_actor_url(http_prefix, nickname, domain_full)
|
||||
actor_json = \
|
||||
getPersonFromCache(base_dir, personUrl, person_cache, False)
|
||||
languagesUnderstood = []
|
||||
languages_understood = []
|
||||
if actor_json:
|
||||
languagesUnderstood = get_actor_languages_list(actor_json)
|
||||
languages_understood = get_actor_languages_list(actor_json)
|
||||
contentStr = get_content_from_post(post_json_object, system_language,
|
||||
languagesUnderstood)
|
||||
languages_understood)
|
||||
if not contentStr:
|
||||
contentStr = \
|
||||
autoTranslatePost(base_dir, post_json_object,
|
||||
|
|
Loading…
Reference in New Issue