franciscop / translate

:sa: Translate text on node.js and the browser with promises
MIT License
288 stars 44 forks source link

Libre engine is asking for an API key #26

Closed opheliagame closed 3 years ago

opheliagame commented 3 years ago

When trying to get translations using libre engine the promise gets rejected with the following message Error: Please contact the server operator to obtain an API key

I am wondering if the libre api changed or something else because the process exits with a non zero code. I was able to do this only a few months back.

demoprazol commented 3 years ago

Same +1

opheliagame commented 3 years ago

I think this issue is the reason

franciscop commented 3 years ago

This is fairly expected since I'm sure a free service like this would get abused at some point. To fix it, you can either get a key from the official website or install Libretranslate on your own server and specify the URL+Key:

// Use the key with the official website
translate.key = process.env.TRANSLATE_KEY;

// OR

// Install in your own server and set up the URL and key:
translate.url = "https://example.com/";
translate.key = process.env.TRANSLATE_KEY;

This should be added as a note somewhere in translate documentation though, so I'll leave the issue it open for now.

franciscop commented 3 years ago

Added two notes on the README regarding Libretranslate, so I'm closing this issue :)