A screen shot of the Mastodon code that handles the post request to the libretranslate endpoint, showing how it adds the "/translate" to the end of the configured endpoint value:
def request(text, source_language, target_language)
req = Request.new(:post, "#{@base_url}/translate", body: Oj.dump(q: text, source: source_language, target: target_language, format: 'html', api_key: @api_key))
req.add_headers('Content-Type': 'application/json')
req
end
Screenshot of my libretranslate configuration in the .env.production file:
# translation config
LIBRE_TRANSLATE_ENDPOINT=https://libretranslate.com
LIBRE_TRANSLATE_API_KEY=[Your API Key]
In this case you would replace [Your API Key] with an actual API key purchased from libretranslate
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 […]
[Original post on beige.party]