translate to html

This commit is contained in:
Antonio J. Delgado 2025-02-18 14:46:41 +02:00
parent b185b02073
commit 705dfe7196
2 changed files with 7 additions and 2 deletions

View file

@ -275,7 +275,8 @@ class MastodonEmailBridge:
return data
fields_to_translate = [
'spoiler',
'content'
'content',
'description'
]
counter = 0
for field in fields_to_translate:
@ -305,7 +306,7 @@ class MastodonEmailBridge:
"source": source_language,
"target": destination_language,
"api_key": self.config['libretranslate_token'],
"format": "text",
"format": "html",
}
response = self.translate_session.post(
url=f"{self.config['libretranslate_url']}",

View file

@ -219,6 +219,8 @@
{{ data['reblog']['translated_spoiler'] }}
</DIV>
(Original spoiler)
{% else %}
<!-- no translated_spoiler for reblog -->
{% endif %}
<DIV CLASS='reblog-spoiler'>
{{ data['reblog']['spoiler'] }}
@ -232,6 +234,8 @@
{{ data['reblog']['translated_content'] }}
</DIV>
(Original content)
{% else %}
<!-- no translated_content for reblog -->
{% endif %}
<DIV>
{{ data['reblog']['content'] }}