I've been experimenting with enabling translation on my instance and since I've seen zero documentation about how to configure LibreTranslate with a purchased api key, I'm going to share my findings here.
Pretty much every guide out there for enabling translation on a Mastodon instance using LibreTranslate assumes that you are going to be setting up the LibreTranslate server yourself. That's admirable, but translation is pretty resource-intensive. When I tested this on my instance, it was taking about 2 seconds to translate a post, and even longer for longer posts. Plus there were some languages that weren't working at all. That was probably on me for not setting up the language packs correctly. Maybe I'll give it another try, but somewhere in the middle of wrestling with the translation server, I realized that I'm here to run a Mastodon instance, not a LibreTranslate instance, so I went and purchased an api key from LibreTranslate for their lower tier of $29 a month (good for 80 translations per minute). Based on the average donations we get each month, that seemed a reasonable cost that we could afford. The trouble was, configuring the instance to use the api key didn't seem to be working at all.
Now if you go to https://libretranslate.com it lets you play around with the api and shows what the post request and the subsequent response looks like. In the post request and in the api documentation, the endpoint for the translation service is:
https://libretranslate.com/translate
but if you set LIBRE_TRANSLATE_ENDPOINT to that value in your .env.production file, it won't work. After a bunch of googling and experimentation, I finally went and looked at the pull request for this feature on GitHub. And that's where I saw that in the code for the post request it takes the configured LIBRE_TRANSLATE_ENDPOINT value and then adds the "/translate" at the end of it.
Even though I was sure I had tried this before, I set LIBRE_TRANSLATE_ENDPOINT to:
Without the "/translate" on the end. I restarted the web service and cleared the cache and it started working perfectly.
It'd be nice if any of this was actually documented somewhere.
https://libretranslate.com has been cloudflared but there is an onion instance now
http://lt.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/
Some ideas to replace existing services with fediverse services ...
Explore
-- https://fediverse.observer/map
-- https://fedidb.org/
-- https://fediverse.party/
YouTube
Watch -- https://docs.invidious.io/instances/
Upload contents -- https://joinpeertube.org/
Search without Google
-- https://searx.space/
Browse Twitter
-- https://github.com/zedeus/nitter/wiki/Instances
Musik
-- https://funkwhale.audio/
Pics / Instagram
-- https://pixelfed.org/
Translate
-- https://libretranslate.com
Reddit
-- https://lemmy.world/instances
... and many more ...
It's been 20 days since I started my journey to use GrapheneOS. And Im thriving! I've removed Google Play services from my phone and set up my PC to automatically redirect away from all Google products. I've also left mainstream social media years ago and have now shifted my social media presence to Fediverse.
In case you're keen to do the same, here's a list of the alternatives I'm using now (this is list is not exhaustive):
Google Docs/Sheets: Cryptpad.fr (https://cryptpad.fr/)
Social Media: Mastodon (come and join us at https://infosec.exchange)
Email: ProtonMail (with personal domain)
Authenticator: Aegis (https://getaegis.app/)
Photo Management: Immich (https://github.com/immich-app/immich)
Google Translate: Libre Translate (https://libretranslate.com/)
Youtube: PeerTube (https://joinpeertube.org/)
Search Engine: SeaRx (on the way to be selfhosted and DuckDuckGo)
Web Browser: Waterfox (https://www.waterfox.net/)
Phone: grapheneOS (from a refurbished Pixel 6)
Google Maps: OpenStreet Map (https://www.openstreetmap.org)
Calendar, Online storage: ProtonDrive, Proton Calendar
App stores: Droidify (F-droid) and Aurora store for the occasional non F-Droid apps (like the ProtonMail client)
Messaging: Matrix (https://matrix.org) Session (https://getsession.org/) and Signal
Notes: Joplin (https://joplinapp.org/)
Yes, there is, but it depends on your server to activate it.
It works through a third party translation service, usually libretranslate.com, and it requires your server to pay the translation service a monthly fee.
If it's active on your server, you will see a "translate" button below a toot in a foreign language. I'm not sure if every app supports the translate button, but the website interface definitely does.
Yes, they do, if the admin has paid for a translation service to be installed.
There is no translation built into Mastodon, but there are features to integrate open source third party translation services like https://libretranslate.com. These third party services charge a certain amount for their API, to cover their costs.
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.