Lingva Translate Gateway for Mastodon (LibreTranslate API compatible)
-
Install the
flask
packagepip install flask
-
Install the modified
pylingva
git clone https://git.catswords.net/gnh1201/pylingva && cd pylingva pip install .
-
Add lines to
.env.production
LIBRE_TRANSLATE_ENDPOINT=https://translation-api.example.org # YOUR API URL LIBRE_TRANSLATE_API_KEY=true
-
Run mastodon-lingva (Or use
mastodon-lingva.service
)python3 server.py &
-
Restart all related processes
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'q=hello world&source=en&target=ko' http://localhost:5000/translate
curl -X POST -H "Content-Type: application/json" -d '{"q":["hello world"],"source":"en","target":"ko"}' http://localhost:5000/translate
- pylingva (modified version): https://git.catswords.net/gnh1201/pylingva
- Lingva Translate: https://github.com/thedaviddelta/lingva-translate
- ActivityPub @gnh1201@catswords.social
- abuse@catswords.net