translate to html
This commit is contained in:
parent
b185b02073
commit
705dfe7196
2 changed files with 7 additions and 2 deletions
|
@ -275,7 +275,8 @@ class MastodonEmailBridge:
|
||||||
return data
|
return data
|
||||||
fields_to_translate = [
|
fields_to_translate = [
|
||||||
'spoiler',
|
'spoiler',
|
||||||
'content'
|
'content',
|
||||||
|
'description'
|
||||||
]
|
]
|
||||||
counter = 0
|
counter = 0
|
||||||
for field in fields_to_translate:
|
for field in fields_to_translate:
|
||||||
|
@ -305,7 +306,7 @@ class MastodonEmailBridge:
|
||||||
"source": source_language,
|
"source": source_language,
|
||||||
"target": destination_language,
|
"target": destination_language,
|
||||||
"api_key": self.config['libretranslate_token'],
|
"api_key": self.config['libretranslate_token'],
|
||||||
"format": "text",
|
"format": "html",
|
||||||
}
|
}
|
||||||
response = self.translate_session.post(
|
response = self.translate_session.post(
|
||||||
url=f"{self.config['libretranslate_url']}",
|
url=f"{self.config['libretranslate_url']}",
|
||||||
|
|
|
@ -219,6 +219,8 @@
|
||||||
{{ data['reblog']['translated_spoiler'] }}
|
{{ data['reblog']['translated_spoiler'] }}
|
||||||
</DIV>
|
</DIV>
|
||||||
(Original spoiler)
|
(Original spoiler)
|
||||||
|
{% else %}
|
||||||
|
<!-- no translated_spoiler for reblog -->
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<DIV CLASS='reblog-spoiler'>
|
<DIV CLASS='reblog-spoiler'>
|
||||||
{{ data['reblog']['spoiler'] }}
|
{{ data['reblog']['spoiler'] }}
|
||||||
|
@ -232,6 +234,8 @@
|
||||||
{{ data['reblog']['translated_content'] }}
|
{{ data['reblog']['translated_content'] }}
|
||||||
</DIV>
|
</DIV>
|
||||||
(Original content)
|
(Original content)
|
||||||
|
{% else %}
|
||||||
|
<!-- no translated_content for reblog -->
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<DIV>
|
<DIV>
|
||||||
{{ data['reblog']['content'] }}
|
{{ data['reblog']['content'] }}
|
||||||
|
|
Loading…
Reference in a new issue