LibreTranslate with Cloudron Mastodon Server
-
OK I have LT setup and running, API key configured.
How do I now edit the Cloudron Mastodon config to use it?
Thanks,
Shane. -
@shanelord01 OK - worked it out.
- Open the web UI for LibreTranslate after setting it up.
- In the "Request" box, there is a line with "const res = await fetch("https://translate.your.domain/translate", "
- Copy the main domain URL (ie https://translate.your.domain" )without the /translate and without quotation marks.
- Open your Cloudron Mastodon app, and open its file manager and edit "env.production"
- At the bottom, add the "#translate section" below here:
# Optionally change default language # DEFAULT_LOCALE=en # translate LIBRE_TRANSLATE_ENDPOINT=https://translate.your.domain LIBRE_TRANSLATE_API_KEY=YOUR_API_KEY
Save this. Restart the Mastodon app.
API Key
If you don't have your API key, open the LibreTranslate Cloudron App Terminal, and issue:su - cloudron -c 'ltmanage keys --api-keys-db-path /app/data/api_keys.db add 120'
You'll get a key like "f67d5afe-aa14-4d37-90f7-f7d9636b721e" in response - use the one you got in reponse.
Optional; set your default language:
# Optionally change default language DEFAULT_LOCALE=en
Update:
After completing setup and ensuring everything works, if you want to stop people from using the Web UI to translate, you can disable it by editing the LibreTranslate "env.sh" file via its Cloudron File Manager, and adding this (then save env.sh and restart LT):export LT_DISABLE_WEB_UI=true
Note: After doing this I've noted the app is stuck reporting as "Starting" in the Cloudron "My Apps" even though it is running fine. Not sure if this is a health check failing in the Cloudron app? @nebulon Any way to do this without causing this issue?
-
-
@shanelord01
What do you think about performance and quality? I was quite disappointed and returned to DeepL for now. -
@shanelord01 My VPS is at ~ 30% most of the time, but I found the LT API to be awfully slow. Mastodon also gave too many 503 errors (due to timeouts? I don't know). And the translation quality is just too poor compared to DeepL. However, I'm happy to have LT available via Cloudron and will certainly give it another try at a later time. I still like the idea of in-house translation without submitting data to a third party.
-
@shanelord01 thanks for the great write up! I will try to enable this on our instance as well.
-
@shanelord01 said in LibreTranslate with Cloudron Mastodon Server:
After doing this I've noted the app is stuck reporting as "Starting" in the Cloudron "My Apps" even though it is running fine
This seems like maybe the box cron job got stuck for some reason. Can you try if
systemctl restart box
fixes the state? -
I have enabled this also with our cloudron mastodon instance now and it works mostly. For some reason mastodon does not always show the translate button and sometimes it also shows it for english posts, which then results in a 503 response error, since libretranslate got the request to translate from en -> en which is wrong.
Just sharing this here, to set expectations.
-
@nebulon
I think Mastodon's translate button only appears if the poster has set a language for his / hear toot that's different from your language settings.
It could be that the LT API relies on the source and destination language settings that are submitted by Mastodon. That could be an explanation for the errors I received, b/c not everyone sets the language correct. Maybe the DeepL API is more flexible here.