mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-12-22 15:16:30 +00:00
Add FAQ
This commit is contained in:
parent
b0a84f30f4
commit
0aa4bcac7f
1 changed files with 24 additions and 0 deletions
24
README.md
24
README.md
|
@ -606,6 +606,30 @@ Add this to an existing NGINX config or save it as `libretranslate` in the `/etc
|
|||
|
||||
</details>
|
||||
|
||||
### Can I do batch translations?
|
||||
|
||||
Yes, pass an array of strings instead of a string to the `q` field:
|
||||
|
||||
```javascript
|
||||
const res = await fetch("https://libretranslate.com/translate", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
q: ["Hello", "world"],
|
||||
source: "en",
|
||||
target: "es"
|
||||
}),
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
|
||||
console.log(await res.json());
|
||||
// {
|
||||
// "translatedText": [
|
||||
// "Hola",
|
||||
// "mundo"
|
||||
// ]
|
||||
// }
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
This work is largely possible thanks to [Argos Translate](https://github.com/argosopentech/argos-translate), which powers the translation engine.
|
||||
|
|
Loading…
Reference in a new issue