Skip to content

gnh1201/mastodon-lingva

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

mastodon-lingva

Lingva Translate Gateway for Mastodon (LibreTranslate API compatible)

Quick start

  1. Install the flask package

    pip install flask
    
  2. Install the modified pylingva

    git clone https://git.catswords.net/gnh1201/pylingva && cd pylingva
    pip install .
    
  3. Add lines to .env.production

    LIBRE_TRANSLATE_ENDPOINT=https://translation-api.example.org   # YOUR API URL
    LIBRE_TRANSLATE_API_KEY=true
    
  4. Run mastodon-lingva (Or use mastodon-lingva.service)

    python3 server.py &
    
  5. Restart all related processes

How to test?

HTML FormData

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'q=hello world&source=en&target=ko' http://localhost:5000/translate

JSON

curl -X POST -H "Content-Type: application/json" -d '{"q":["hello world"],"source":"en","target":"ko"}' http://localhost:5000/translate

Requirements

Contact me