mirror of https://gitlab.com/bashrc2/epicyon
Mark translated posts
parent
fc20b17ea5
commit
aa0a176ebf
16
languages.py
16
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 = \
|
||||
'<p>' + translate['Translated'].upper() + '</p>' + \
|
||||
translatedText
|
||||
return translatedText
|
||||
return ''
|
||||
|
|
|
@ -451,5 +451,6 @@
|
|||
"Custom post submit button text": "عرف نشر إرسال نص زر",
|
||||
"Blocked User Agents": "عوامل المستخدم المحظورة",
|
||||
"Notify me when this account posts": "أعلمني عندما ينشر الحساب هذا",
|
||||
"Languages": "اللغات"
|
||||
"Languages": "اللغات",
|
||||
"Translated": "تترجم"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -451,5 +451,6 @@
|
|||
"Custom post submit button text": "कस्टम पोस्ट सबमिट बटन टेक्स्ट",
|
||||
"Blocked User Agents": "अवरुद्ध उपयोगकर्ता एजेंट",
|
||||
"Notify me when this account posts": "यह खाता पोस्ट होने पर मुझे सूचित करें",
|
||||
"Languages": "बोली"
|
||||
"Languages": "बोली",
|
||||
"Translated": "अनुवाद"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -451,5 +451,6 @@
|
|||
"Custom post submit button text": "カスタムポスト送信ボタンテキスト",
|
||||
"Blocked User Agents": "ブロックされたユーザーエージェント",
|
||||
"Notify me when this account posts": "この口座投稿を通知する",
|
||||
"Languages": "言語"
|
||||
"Languages": "言語",
|
||||
"Translated": "翻訳"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -451,5 +451,6 @@
|
|||
"Custom post submit button text": "Пользовательский пост Отправить кнопку текста",
|
||||
"Blocked User Agents": "Заблокированные пользовательские агенты",
|
||||
"Notify me when this account posts": "Сообщите мне, когда эта учетная запись",
|
||||
"Languages": "Языки"
|
||||
"Languages": "Языки",
|
||||
"Translated": "Перевод"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -451,5 +451,6 @@
|
|||
"Custom post submit button text": "自定义发布提交按钮文本",
|
||||
"Blocked User Agents": "阻止用户代理商",
|
||||
"Notify me when this account posts": "此帐户帖子时通知我",
|
||||
"Languages": "语言"
|
||||
"Languages": "语言",
|
||||
"Translated": "翻译"
|
||||
}
|
||||
|
|
|
@ -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 ''
|
||||
|
||||
|
|
Loading…
Reference in New Issue