diff --git a/languages.py b/languages.py index 99c033152..fe032301d 100644 --- a/languages.py +++ b/languages.py @@ -256,7 +256,7 @@ def _libretranslate(url: str, text: str, def autoTranslatePost(baseDir: str, postJsonObject: {}, - systemLanguage: str) -> str: + systemLanguage: str, translate: {}) -> str: """Tries to automatically translate the given post """ if not hasObjectDict(postJsonObject): @@ -276,8 +276,14 @@ def autoTranslatePost(baseDir: str, postJsonObject: {}, _libretranslateLanguages(libretranslateUrl, libretranslateApiKey) for lang in langList: if msgObject['contentMap'].get(lang): - return _libretranslate(libretranslateUrl, - msgObject['contentMap']['lang'], - lang, systemLanguage, - libretranslateApiKey) + translatedText = \ + _libretranslate(libretranslateUrl, + msgObject['contentMap']['lang'], + lang, systemLanguage, + libretranslateApiKey) + if translatedText: + translatedText = \ + '

' + translate['Translated'].upper() + '

' + \ + translatedText + return translatedText return '' diff --git a/translations/ar.json b/translations/ar.json index 91c834007..01994da3e 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -451,5 +451,6 @@ "Custom post submit button text": "عرف نشر إرسال نص زر", "Blocked User Agents": "عوامل المستخدم المحظورة", "Notify me when this account posts": "أعلمني عندما ينشر الحساب هذا", - "Languages": "اللغات" + "Languages": "اللغات", + "Translated": "تترجم" } diff --git a/translations/ca.json b/translations/ca.json index bec6f3802..3b7911ba9 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Text de botó d'enviament de publicacions personalitzades", "Blocked User Agents": "Agents d'usuari bloquejats", "Notify me when this account posts": "Aviseu-me quan publiqui aquest compte", - "Languages": "Idiomes" + "Languages": "Idiomes", + "Translated": "Traduït" } diff --git a/translations/cy.json b/translations/cy.json index c5d246f25..3bfb2b4e3 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Testun Post Post Post", "Blocked User Agents": "Asiantau defnyddwyr wedi'u blocio", "Notify me when this account posts": "Rhoi gwybod i mi pan fydd y cyfrifon cyfrif hwn", - "Languages": "Ieithoedd" + "Languages": "Ieithoedd", + "Translated": "Chyfieithwyd" } diff --git a/translations/de.json b/translations/de.json index ed3754a9e..38b233dda 100644 --- a/translations/de.json +++ b/translations/de.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Benutzerdefinierte Post-Senden Schaltfläche Text", "Blocked User Agents": "Blockierte Benutzeragenten", "Notify me when this account posts": "Benachrichtigen Sie mich, wenn dieses Konto postet", - "Languages": "Sprachen" + "Languages": "Sprachen", + "Translated": "Übersetzt" } diff --git a/translations/en.json b/translations/en.json index d2d8405e7..644d41b83 100644 --- a/translations/en.json +++ b/translations/en.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Custom post submit button text", "Blocked User Agents": "Blocked User Agents", "Notify me when this account posts": "Notify me when this account posts", - "Languages": "Languages" + "Languages": "Languages", + "Translated": "Translated" } diff --git a/translations/es.json b/translations/es.json index ef9d0a1e7..c1d9ea13d 100644 --- a/translations/es.json +++ b/translations/es.json @@ -451,5 +451,6 @@ "Custom post submit button text": "POST POST PERSONALIZADO Botón Texto", "Blocked User Agents": "Agentes de usuario bloqueados", "Notify me when this account posts": "Notifíqueme cuando se publique esta cuenta", - "Languages": "Idiomas" + "Languages": "Idiomas", + "Translated": "Traducida" } diff --git a/translations/fr.json b/translations/fr.json index cbcba6a5c..015e6ed11 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Texte de bouton d'envoi postal personnalisé", "Blocked User Agents": "Agents d'utilisateur bloqués", "Notify me when this account posts": "Avertissez-moi quand ce compte publie", - "Languages": "Langues" + "Languages": "Langues", + "Translated": "Traduite" } diff --git a/translations/ga.json b/translations/ga.json index f5b4b3799..a7008e056 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Post saincheaptha Cuir isteach an cnaipe Téacs", "Blocked User Agents": "Gníomhairí úsáideora blocáilte", "Notify me when this account posts": "Cuir in iúl dom nuair a phostófar an cuntas seo", - "Languages": "Teangacha" + "Languages": "Teangacha", + "Translated": "Aistrithe" } diff --git a/translations/hi.json b/translations/hi.json index 01d615739..5f389a268 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -451,5 +451,6 @@ "Custom post submit button text": "कस्टम पोस्ट सबमिट बटन टेक्स्ट", "Blocked User Agents": "अवरुद्ध उपयोगकर्ता एजेंट", "Notify me when this account posts": "यह खाता पोस्ट होने पर मुझे सूचित करें", - "Languages": "बोली" + "Languages": "बोली", + "Translated": "अनुवाद" } diff --git a/translations/it.json b/translations/it.json index 5d9081d71..103a3aef5 100644 --- a/translations/it.json +++ b/translations/it.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Pulsante di invio del post personalizzato", "Blocked User Agents": "Agenti utente bloccati", "Notify me when this account posts": "Avvisami quando questo account messaggi", - "Languages": "Le lingue" + "Languages": "Le lingue", + "Translated": "Tradotto" } diff --git a/translations/ja.json b/translations/ja.json index 157a6bddb..c8f022fd2 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -451,5 +451,6 @@ "Custom post submit button text": "カスタムポスト送信ボタンテキスト", "Blocked User Agents": "ブロックされたユーザーエージェント", "Notify me when this account posts": "この口座投稿を通知する", - "Languages": "言語" + "Languages": "言語", + "Translated": "翻訳" } diff --git a/translations/ku.json b/translations/ku.json index 6b87537cd..8053032d2 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Nivîsa bişkojka paşîn a paşîn", "Blocked User Agents": "Karmendên bikarhêner asteng kirin", "Notify me when this account posts": "Dema ku ev postên hesabê min agahdar bikin", - "Languages": "Ziman" + "Languages": "Ziman", + "Translated": "Wergerandin" } diff --git a/translations/oc.json b/translations/oc.json index 2ccf6da01..c16657c80 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -447,5 +447,6 @@ "Custom post submit button text": "Custom post submit button text", "Blocked User Agents": "Blocked User Agents", "Notify me when this account posts": "Notify me when this account posts", - "Languages": "Languages" + "Languages": "Languages", + "Translated": "Translated" } diff --git a/translations/pt.json b/translations/pt.json index c1b0efbc1..13ef8a929 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Texto de botão de envio de post personalizado", "Blocked User Agents": "Agentes de usuário bloqueados", "Notify me when this account posts": "Notifique-me quando esta conta posts", - "Languages": "Línguas" + "Languages": "Línguas", + "Translated": "Traduzida" } diff --git a/translations/ru.json b/translations/ru.json index d31d4133d..71eaf6606 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Пользовательский пост Отправить кнопку текста", "Blocked User Agents": "Заблокированные пользовательские агенты", "Notify me when this account posts": "Сообщите мне, когда эта учетная запись", - "Languages": "Языки" + "Languages": "Языки", + "Translated": "Перевод" } diff --git a/translations/sw.json b/translations/sw.json index aac84cd23..29537cef9 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -451,5 +451,6 @@ "Custom post submit button text": "Ujumbe wa Desturi Wasilisha Nakala ya kifungo", "Blocked User Agents": "Wakala wa watumiaji waliozuiwa", "Notify me when this account posts": "Nijulishe wakati akaunti hii ya akaunti.", - "Languages": "Lugha" + "Languages": "Lugha", + "Translated": "Ilitafsiriwa" } diff --git a/translations/zh.json b/translations/zh.json index 1ffbe2591..54cd7658e 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -451,5 +451,6 @@ "Custom post submit button text": "自定义发布提交按钮文本", "Blocked User Agents": "阻止用户代理商", "Notify me when this account posts": "此帐户帖子时通知我", - "Languages": "语言" + "Languages": "语言", + "Translated": "翻译" } diff --git a/webapp_post.py b/webapp_post.py index 9614d56b1..797a96204 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1594,7 +1594,9 @@ def individualPostAsHtml(allowDownloads: bool, contentStr = getContentFromPost(postJsonObject, systemLanguage) if not contentStr: - contentStr = autoTranslatePost(baseDir, postJsonObject, systemLanguage) + contentStr = \ + autoTranslatePost(baseDir, postJsonObject, + systemLanguage, translate) if not contentStr: return ''