You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
orx d6230fd9d9 another commit 2 weeks ago
DeepL.php another commit 3 weeks ago
Mod_DeepL.php another commit 2 weeks ago
README.md another commit 2 weeks ago
deepl.apd another commit 3 weeks ago
deepl.css another commit 3 weeks ago
deepl.js another commit 3 weeks ago
deepl.php another commit 2 weeks ago
deepl.png another commit 3 weeks ago
deepl.yml another commit 3 weeks ago

README.md

Streams DeepL addon/app (alpha)

Addon/app for translation of content of messages shown in channel stream using third-party translation service https://deepl.com

How it works

Addon registers hooks for prepare_body and calls the DeepL API sending the message content and appends translated result into the message body. This is done every time message is shown and for every messages and all comments in conversations. Each person has their own DeepL API key (currently free API is limited to 500.000 characters/month). In app settings there can be specified which language(s) to translate and target language. Message language is decided according to [item][lang] variable set by Streams and sometimes is not correct.

Limitations and further development

This is an alpha version just for testing. Not recommended for public availability on the instance.

  • No text filtering is done yet. Only text could be extracted and no HTML tags sent for translation. No validation is done upon translated text inserted into message, so invalid tags in returned text can break channel stream loading.
  • The message language can be different from provided, so proper language detection should be made and that needs calling DeepL anyway.
  • No app UI translations, app is in english.

Possible further development concepts:

  • No translation server-side, just provide "Translate" button with the message and by clicking it the text is translated via Javascript DeepL API call. Problems: properly escaping the message text for inclusion in JS code. Any invalid char breaking the XHTML/JS syntax disrupts channel stream loading. Could be done by taking the text directly from the encapsulating DIV tag. The repo already contains some unfinished code fro this development.
  • Translatin when message is received by instance. That would prevent multiple translations with each view of each person, but require store multiple language translations in DB, use server-side API key and paid professional API.

Adaptation from Free DeepL API to professional without character count limitation is easy change in one line of code. Provide the translation as server-side service without people needing to register for their own API key is also possible - removing the form field for key in settings and provide the addon with instance key for desired service class.

Installation

  • Put the repo content in /extend/addon/deepl dir in your Streams instance root. Create /deepl symlink for it in /addon dir.

  • Go to Site Admin app as instance admin and enable DeepL addon.

How to use

  • Register account at https://deepl.com, apply for "DeepL API Free" and get the "Authentication Key for DeepL API"

  • Go to Available Apps on your Streams channel and install DeepL App.

  • Go to DeepL App settings and paste the API key into the form, add the language(s) to translate and desired target language in Deepl shortcut form as listed on this page https://www.deepl.com/docs-api/translate-text/translate-text/

  • Go to channel settings and limit maximum number of conversations to load each time to max 3 or according to translated language(s) occurence in your stream (Display settings - > Content settings)

  • Go to your channel stream and see the posts translated. Expect longer loading times when conversations have a lot of replies.

Licence

Free

Using library https://github.com/Baby-Markt/deepl-php-lib MIT licence